Merge "Add LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH into Shell permission" am: a3243e8e6e
Change-Id: Ia492d4fec8f5f033b19063183783c39fa6df5e49
This commit is contained in:
@@ -168,9 +168,11 @@ public class PhoneStateListener {
|
|||||||
public static final int LISTEN_SIGNAL_STRENGTHS = 0x00000100;
|
public static final int LISTEN_SIGNAL_STRENGTHS = 0x00000100;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listen for always reported changes of the network signal strengths (cellular),
|
* Listen for changes of the network signal strengths (cellular) always reported from modem,
|
||||||
* even in some situations such as the screen of the device is off.
|
* even in some situations such as the screen of the device is off.
|
||||||
*
|
*
|
||||||
|
* @see #onSignalStrengthsChanged
|
||||||
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@RequiresPermission(android.Manifest.permission.LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH)
|
@RequiresPermission(android.Manifest.permission.LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH)
|
||||||
|
|||||||
@@ -211,6 +211,9 @@
|
|||||||
<!-- Permission required for CTS test - CrossProfileAppsHostSideTest -->
|
<!-- Permission required for CTS test - CrossProfileAppsHostSideTest -->
|
||||||
<uses-permission android:name="android.permission.INTERACT_ACROSS_PROFILES"/>
|
<uses-permission android:name="android.permission.INTERACT_ACROSS_PROFILES"/>
|
||||||
|
|
||||||
|
<!-- permissions required for CTS test - PhoneStateListenerTest -->
|
||||||
|
<uses-permission android:name="android.permission.LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH" />
|
||||||
|
|
||||||
<!-- Permission required for CTS test - UiModeManagerTest -->
|
<!-- Permission required for CTS test - UiModeManagerTest -->
|
||||||
<uses-permission android:name="android.permission.ENTER_CAR_MODE_PRIORITIZED"/>
|
<uses-permission android:name="android.permission.ENTER_CAR_MODE_PRIORITIZED"/>
|
||||||
|
|
||||||
|
|||||||
@@ -891,6 +891,13 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
if ((events & PhoneStateListener.LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH)
|
if ((events & PhoneStateListener.LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH)
|
||||||
!= 0) {
|
!= 0) {
|
||||||
updateReportSignalStrengthDecision(r.subId);
|
updateReportSignalStrengthDecision(r.subId);
|
||||||
|
try {
|
||||||
|
if (mSignalStrength[phoneId] != null) {
|
||||||
|
r.callback.onSignalStrengthsChanged(mSignalStrength[phoneId]);
|
||||||
|
}
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
remove(r.binder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (validateEventsAndUserLocked(r, PhoneStateListener.LISTEN_CELL_INFO)) {
|
if (validateEventsAndUserLocked(r, PhoneStateListener.LISTEN_CELL_INFO)) {
|
||||||
try {
|
try {
|
||||||
@@ -1307,9 +1314,10 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
log("notifySignalStrengthForPhoneId: r=" + r + " subId=" + subId
|
log("notifySignalStrengthForPhoneId: r=" + r + " subId=" + subId
|
||||||
+ " phoneId=" + phoneId + " ss=" + signalStrength);
|
+ " phoneId=" + phoneId + " ss=" + signalStrength);
|
||||||
}
|
}
|
||||||
if (r.matchPhoneStateListenerEvent(
|
if ((r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_SIGNAL_STRENGTHS)
|
||||||
PhoneStateListener.LISTEN_SIGNAL_STRENGTHS) &&
|
|| r.matchPhoneStateListenerEvent(
|
||||||
idMatch(r.subId, subId, phoneId)) {
|
PhoneStateListener.LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH))
|
||||||
|
&& idMatch(r.subId, subId, phoneId)) {
|
||||||
try {
|
try {
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
log("notifySignalStrengthForPhoneId: callback.onSsS r=" + r
|
log("notifySignalStrengthForPhoneId: callback.onSsS r=" + r
|
||||||
@@ -1322,7 +1330,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_SIGNAL_STRENGTH) &&
|
if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_SIGNAL_STRENGTH) &&
|
||||||
idMatch(r.subId, subId, phoneId)){
|
idMatch(r.subId, subId, phoneId)) {
|
||||||
try {
|
try {
|
||||||
int gsmSignalStrength = signalStrength.getGsmSignalStrength();
|
int gsmSignalStrength = signalStrength.getGsmSignalStrength();
|
||||||
int ss = (gsmSignalStrength == 99 ? -1 : gsmSignalStrength);
|
int ss = (gsmSignalStrength == 99 ? -1 : gsmSignalStrength);
|
||||||
@@ -2454,6 +2462,11 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION, null);
|
android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((events & PhoneStateListener.LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH) != 0) {
|
||||||
|
mContext.enforceCallingOrSelfPermission(
|
||||||
|
android.Manifest.permission.LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH, null);
|
||||||
|
}
|
||||||
|
|
||||||
if ((events & READ_PRIVILEGED_PHONE_STATE_PERMISSION_MASK) != 0) {
|
if ((events & READ_PRIVILEGED_PHONE_STATE_PERMISSION_MASK) != 0) {
|
||||||
mContext.enforceCallingOrSelfPermission(
|
mContext.enforceCallingOrSelfPermission(
|
||||||
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, null);
|
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, null);
|
||||||
@@ -2569,7 +2582,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((events & PhoneStateListener.LISTEN_SIGNAL_STRENGTHS) != 0) {
|
if ((events & PhoneStateListener.LISTEN_SIGNAL_STRENGTHS) != 0
|
||||||
|
|| (events & PhoneStateListener.LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH) != 0) {
|
||||||
try {
|
try {
|
||||||
if (mSignalStrength[phoneId] != null) {
|
if (mSignalStrength[phoneId] != null) {
|
||||||
SignalStrength signalStrength = mSignalStrength[phoneId];
|
SignalStrength signalStrength = mSignalStrength[phoneId];
|
||||||
|
|||||||
Reference in New Issue
Block a user