Merge "Fix app standby bugs." into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
9d62182591
@@ -1322,6 +1322,8 @@ public class AppStandbyController implements AppStandbyInternal {
|
|||||||
|
|
||||||
private void setAppStandbyBucket(String packageName, int userId, @StandbyBuckets int newBucket,
|
private void setAppStandbyBucket(String packageName, int userId, @StandbyBuckets int newBucket,
|
||||||
int reason, long elapsedRealtime, boolean resetTimeout) {
|
int reason, long elapsedRealtime, boolean resetTimeout) {
|
||||||
|
if (!mAppIdleEnabled) return;
|
||||||
|
|
||||||
synchronized (mAppIdleLock) {
|
synchronized (mAppIdleLock) {
|
||||||
// If the package is not installed, don't allow the bucket to be set.
|
// If the package is not installed, don't allow the bucket to be set.
|
||||||
if (!mInjector.isPackageInstalled(packageName, 0, userId)) {
|
if (!mInjector.isPackageInstalled(packageName, 0, userId)) {
|
||||||
|
|||||||
@@ -448,6 +448,7 @@ public class AppStateTracker {
|
|||||||
IntentFilter filter = new IntentFilter();
|
IntentFilter filter = new IntentFilter();
|
||||||
filter.addAction(Intent.ACTION_USER_REMOVED);
|
filter.addAction(Intent.ACTION_USER_REMOVED);
|
||||||
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
|
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
|
||||||
|
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
|
||||||
mContext.registerReceiver(new MyReceiver(), filter);
|
mContext.registerReceiver(new MyReceiver(), filter);
|
||||||
|
|
||||||
refreshForcedAppStandbyUidPackagesLocked();
|
refreshForcedAppStandbyUidPackagesLocked();
|
||||||
@@ -688,6 +689,13 @@ public class AppStateTracker {
|
|||||||
mIsPluggedIn = (intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0) != 0);
|
mIsPluggedIn = (intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0) != 0);
|
||||||
}
|
}
|
||||||
updateForceAllAppStandbyState();
|
updateForceAllAppStandbyState();
|
||||||
|
} else if (Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())
|
||||||
|
&& !intent.getBooleanExtra(Intent.EXTRA_REPLACING, false)) {
|
||||||
|
final int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, -1);
|
||||||
|
final String pkgName = intent.getData().getSchemeSpecificPart();
|
||||||
|
if (mExemptedPackages.remove(userId, pkgName)) {
|
||||||
|
mHandler.notifyExemptChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user