Merge "The heads up now correctly dissapears when clicking" into mnc-dev
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index ecb7f5a..80169a9 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -2615,7 +2615,9 @@
getMobileRadioActiveAdjustedTime(which) / 1000, interactiveTime / 1000,
powerSaveModeEnabledTime / 1000, connChanges, deviceIdleModeEnabledTime / 1000,
getDeviceIdleModeEnabledCount(which), deviceIdlingTime / 1000,
- getDeviceIdlingCount(which));
+ getDeviceIdlingCount(which),
+ getMobileRadioActiveCount(which),
+ getMobileRadioActiveUnknownTime(which) / 1000);
// Dump screen brightness stats
Object[] args = new Object[NUM_SCREEN_BRIGHTNESS_BINS];
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java
index b9f62e6..10a4cd1 100644
--- a/services/core/java/com/android/server/BluetoothManagerService.java
+++ b/services/core/java/com/android/server/BluetoothManagerService.java
@@ -805,6 +805,7 @@
IBinder mService;
ComponentName mClassName;
Intent mIntent;
+ boolean mInvokingProxyCallbacks = false;
ProfileServiceConnections(Intent intent) {
mService = null;
@@ -871,34 +872,54 @@
} catch (RemoteException e) {
Log.e(TAG, "Unable to linkToDeath", e);
}
- int n = mProxies.beginBroadcast();
- for (int i = 0; i < n; i++) {
- try {
- mProxies.getBroadcastItem(i).onServiceConnected(className, service);
- } catch (RemoteException e) {
- Log.e(TAG, "Unable to connect to proxy", e);
- }
+
+ if (mInvokingProxyCallbacks) {
+ Log.e(TAG, "Proxy callbacks already in progress.");
+ return;
}
- mProxies.finishBroadcast();
+ mInvokingProxyCallbacks = true;
+
+ final int n = mProxies.beginBroadcast();
+ try {
+ for (int i = 0; i < n; i++) {
+ try {
+ mProxies.getBroadcastItem(i).onServiceConnected(className, service);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Unable to connect to proxy", e);
+ }
+ }
+ } finally {
+ mProxies.finishBroadcast();
+ mInvokingProxyCallbacks = false;
+ }
}
@Override
public void onServiceDisconnected(ComponentName className) {
- if (mService == null) {
- return;
- }
+ if (mService == null) return;
mService.unlinkToDeath(this, 0);
mService = null;
mClassName = null;
- int n = mProxies.beginBroadcast();
- for (int i = 0; i < n; i++) {
- try {
- mProxies.getBroadcastItem(i).onServiceDisconnected(className);
- } catch (RemoteException e) {
- Log.e(TAG, "Unable to disconnect from proxy", e);
- }
+
+ if (mInvokingProxyCallbacks) {
+ Log.e(TAG, "Proxy callbacks already in progress.");
+ return;
}
- mProxies.finishBroadcast();
+ mInvokingProxyCallbacks = true;
+
+ final int n = mProxies.beginBroadcast();
+ try {
+ for (int i = 0; i < n; i++) {
+ try {
+ mProxies.getBroadcastItem(i).onServiceDisconnected(className);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Unable to disconnect from proxy", e);
+ }
+ }
+ } finally {
+ mProxies.finishBroadcast();
+ mInvokingProxyCallbacks = false;
+ }
}
@Override
@@ -916,16 +937,19 @@
}
private void sendBluetoothStateCallback(boolean isUp) {
- int n = mStateChangeCallbacks.beginBroadcast();
- if (DBG) Log.d(TAG,"Broadcasting onBluetoothStateChange("+isUp+") to " + n + " receivers.");
- for (int i=0; i <n;i++) {
- try {
- mStateChangeCallbacks.getBroadcastItem(i).onBluetoothStateChange(isUp);
- } catch (RemoteException e) {
- Log.e(TAG, "Unable to call onBluetoothStateChange() on callback #" + i , e);
+ try {
+ int n = mStateChangeCallbacks.beginBroadcast();
+ if (DBG) Log.d(TAG,"Broadcasting onBluetoothStateChange("+isUp+") to " + n + " receivers.");
+ for (int i=0; i <n;i++) {
+ try {
+ mStateChangeCallbacks.getBroadcastItem(i).onBluetoothStateChange(isUp);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Unable to call onBluetoothStateChange() on callback #" + i , e);
+ }
}
+ } finally {
+ mStateChangeCallbacks.finishBroadcast();
}
- mStateChangeCallbacks.finishBroadcast();
}
/**
@@ -934,16 +958,19 @@
private void sendBluetoothServiceUpCallback() {
if (!mConnection.isGetNameAddressOnly()) {
if (DBG) Log.d(TAG,"Calling onBluetoothServiceUp callbacks");
- int n = mCallbacks.beginBroadcast();
- Log.d(TAG,"Broadcasting onBluetoothServiceUp() to " + n + " receivers.");
- for (int i=0; i <n;i++) {
- try {
- mCallbacks.getBroadcastItem(i).onBluetoothServiceUp(mBluetooth);
- } catch (RemoteException e) {
- Log.e(TAG, "Unable to call onBluetoothServiceUp() on callback #" + i, e);
+ try {
+ int n = mCallbacks.beginBroadcast();
+ Log.d(TAG,"Broadcasting onBluetoothServiceUp() to " + n + " receivers.");
+ for (int i=0; i <n;i++) {
+ try {
+ mCallbacks.getBroadcastItem(i).onBluetoothServiceUp(mBluetooth);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Unable to call onBluetoothServiceUp() on callback #" + i, e);
+ }
}
+ } finally {
+ mCallbacks.finishBroadcast();
}
- mCallbacks.finishBroadcast();
}
}
/**
@@ -952,16 +979,19 @@
private void sendBluetoothServiceDownCallback() {
if (!mConnection.isGetNameAddressOnly()) {
if (DBG) Log.d(TAG,"Calling onBluetoothServiceDown callbacks");
- int n = mCallbacks.beginBroadcast();
- Log.d(TAG,"Broadcasting onBluetoothServiceDown() to " + n + " receivers.");
- for (int i=0; i <n;i++) {
- try {
- mCallbacks.getBroadcastItem(i).onBluetoothServiceDown();
- } catch (RemoteException e) {
- Log.e(TAG, "Unable to call onBluetoothServiceDown() on callback #" + i, e);
+ try {
+ int n = mCallbacks.beginBroadcast();
+ Log.d(TAG,"Broadcasting onBluetoothServiceDown() to " + n + " receivers.");
+ for (int i=0; i <n;i++) {
+ try {
+ mCallbacks.getBroadcastItem(i).onBluetoothServiceDown();
+ } catch (RemoteException e) {
+ Log.e(TAG, "Unable to call onBluetoothServiceDown() on callback #" + i, e);
+ }
}
+ } finally {
+ mCallbacks.finishBroadcast();
}
- mCallbacks.finishBroadcast();
}
}
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index a06bb30..19a4851 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -362,10 +362,10 @@
}
try {
- mContext.enforceCallingPermission(
+ mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
"addOnSubscriptionsChangedListener");
- // SKIP checking for run-time permission since obtained PRIVILEGED
+ // SKIP checking for run-time permission since caller or self has PRIVILEGED permission
} catch (SecurityException e) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.READ_PHONE_STATE,
@@ -481,9 +481,10 @@
if ((events & ENFORCE_PHONE_STATE_PERMISSION_MASK) != 0) {
try {
- mContext.enforceCallingPermission(
+ mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, null);
- // SKIP checking for run-time permission since obtained PRIVILEGED
+ // SKIP checking for run-time permission since caller or self has PRIVILEGED
+ // permission
} catch (SecurityException e) {
if (mAppOps.noteOp(AppOpsManager.OP_READ_PHONE_STATE, Binder.getCallingUid(),
callingPackage) != AppOpsManager.MODE_ALLOWED) {
@@ -661,10 +662,10 @@
}
private boolean canReadPhoneState(String callingPackage) {
- if (mContext.checkCallingPermission(
+ if (mContext.checkCallingOrSelfPermission(
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) ==
PackageManager.PERMISSION_GRANTED) {
- // SKIP checking for run-time permission since obtained PRIVILEGED
+ // SKIP checking for run-time permission since caller or self has PRIVILEGED permission
return true;
}
boolean canReadPhoneState = mContext.checkCallingOrSelfPermission(
@@ -1589,9 +1590,10 @@
if ((events & ENFORCE_PHONE_STATE_PERMISSION_MASK) != 0) {
try {
- mContext.enforceCallingPermission(
+ mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, null);
- // SKIP checking for run-time permission since obtained PRIVILEGED
+ // SKIP checking for run-time permission since caller or self has PRIVILEGED
+ // permission
} catch (SecurityException e) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.READ_PHONE_STATE, null);
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
index cd982d3..46bda8c 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -1668,8 +1668,9 @@
public NetworkPolicy[] getNetworkPolicies(String callingPackage) {
mContext.enforceCallingOrSelfPermission(MANAGE_NETWORK_POLICY, TAG);
try {
- mContext.enforceCallingPermission(READ_PRIVILEGED_PHONE_STATE, TAG);
- // SKIP checking run-time OP_READ_PHONE_STATE since using PRIVILEGED
+ mContext.enforceCallingOrSelfPermission(READ_PRIVILEGED_PHONE_STATE, TAG);
+ // SKIP checking run-time OP_READ_PHONE_STATE since caller or self has PRIVILEGED
+ // permission
} catch (SecurityException e) {
mContext.enforceCallingOrSelfPermission(READ_PHONE_STATE, TAG);