diff options
Diffstat (limited to 'services')
8 files changed, 68 insertions, 41 deletions
diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java index 8d9c965..12003e2 100644 --- a/services/backup/java/com/android/server/backup/BackupManagerService.java +++ b/services/backup/java/com/android/server/backup/BackupManagerService.java @@ -401,21 +401,40 @@ public class BackupManagerService { public boolean isSystemRestore; public String[] filterSet; - // Restore a single package + /** + * Restore a single package; no kill after restore + */ RestoreParams(IBackupTransport _transport, String _dirName, IRestoreObserver _obs, - long _token, PackageInfo _pkg, int _pmToken) { + long _token, PackageInfo _pkg) { transport = _transport; dirName = _dirName; observer = _obs; token = _token; pkgInfo = _pkg; - pmToken = _pmToken; + pmToken = 0; isSystemRestore = false; filterSet = null; } - // Restore everything possible. This is the form that Setup Wizard or similar - // restore UXes use. + /** + * Restore at install: PM token needed, kill after restore + */ + RestoreParams(IBackupTransport _transport, String _dirName, IRestoreObserver _obs, + long _token, String _pkgName, int _pmToken) { + transport = _transport; + dirName = _dirName; + observer = _obs; + token = _token; + pkgInfo = null; + pmToken = _pmToken; + isSystemRestore = false; + filterSet = new String[] { _pkgName }; + } + + /** + * Restore everything possible. This is the form that Setup Wizard or similar + * restore UXes use. + */ RestoreParams(IBackupTransport _transport, String _dirName, IRestoreObserver _obs, long _token) { transport = _transport; @@ -428,8 +447,10 @@ public class BackupManagerService { filterSet = null; } - // Restore some set of packages. Leave this one up to the caller to specify - // whether it's to be considered a system-level restore. + /** + * Restore some set of packages. Leave this one up to the caller to specify + * whether it's to be considered a system-level restore. + */ RestoreParams(IBackupTransport _transport, String _dirName, IRestoreObserver _obs, long _token, String[] _filterSet, boolean _isSystemRestore) { transport = _transport; @@ -1934,10 +1955,12 @@ public class BackupManagerService { .setPackage(pkgInfo.packageName); List<ResolveInfo> hosts = mPackageManager.queryIntentServicesAsUser( intent, 0, UserHandle.USER_OWNER); - final int N = hosts.size(); - for (int i = 0; i < N; i++) { - final ServiceInfo info = hosts.get(i).serviceInfo; - tryBindTransport(info); + if (hosts != null) { + final int N = hosts.size(); + for (int i = 0; i < N; i++) { + final ServiceInfo info = hosts.get(i).serviceInfo; + tryBindTransport(info); + } } } @@ -9136,19 +9159,13 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF // This can throw and so *must* happen before the wakelock is acquired String dirName = transport.transportDirName(); - // We can use a synthetic PackageInfo here because: - // 1. We know it's valid, since the Package Manager supplied the name - // 2. Only the packageName field will be used by the restore code - PackageInfo pkg = new PackageInfo(); - pkg.packageName = packageName; - mWakelock.acquire(); if (MORE_DEBUG) { Slog.d(TAG, "Restore at install of " + packageName); } Message msg = mBackupHandler.obtainMessage(MSG_RUN_RESTORE); msg.obj = new RestoreParams(transport, dirName, null, - restoreSet, pkg, token); + restoreSet, packageName, token); mBackupHandler.sendMessage(msg); } catch (RemoteException e) { // Binding to the transport broke; back off and proceed with the installation. @@ -9527,8 +9544,7 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF Slog.d(TAG, "restorePackage() : " + packageName); } Message msg = mBackupHandler.obtainMessage(MSG_RUN_RESTORE); - msg.obj = new RestoreParams(mRestoreTransport, dirName, - observer, token, app, 0); + msg.obj = new RestoreParams(mRestoreTransport, dirName, observer, token, app); mBackupHandler.sendMessage(msg); } finally { Binder.restoreCallingIdentity(oldId); diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java index d58d372..e3d5d38 100644 --- a/services/core/java/com/android/server/AlarmManagerService.java +++ b/services/core/java/com/android/server/AlarmManagerService.java @@ -177,7 +177,7 @@ class AlarmManagerService extends SystemService { private static final long DEFAULT_MIN_FUTURITY = 5 * 1000; private static final long DEFAULT_MIN_INTERVAL = 60 * 1000; - private static final long DEFAULT_ALLOW_WHILE_IDLE_SHORT_TIME = 60*1000; + private static final long DEFAULT_ALLOW_WHILE_IDLE_SHORT_TIME = DEFAULT_MIN_FUTURITY; private static final long DEFAULT_ALLOW_WHILE_IDLE_LONG_TIME = 15*60*1000; private static final long DEFAULT_ALLOW_WHILE_IDLE_WHITELIST_DURATION = 10*1000; diff --git a/services/core/java/com/android/server/AppOpsService.java b/services/core/java/com/android/server/AppOpsService.java index 56ebed6..c373fb8 100644 --- a/services/core/java/com/android/server/AppOpsService.java +++ b/services/core/java/com/android/server/AppOpsService.java @@ -1569,6 +1569,8 @@ public class AppOpsService extends IAppOpsService.Stub { if ("-h".equals(arg)) { dumpHelp(pw); return; + } else if ("-a".equals(arg)) { + // dump all data } else if ("write-settings".equals(arg)) { long token = Binder.clearCallingIdentity(); try { diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 113c9b6..191bf99 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -10730,7 +10730,7 @@ public final class ActivityManagerService extends ActivityManagerNative synchronized (this) { buildAssistBundleLocked(pae, pae.result); mPendingAssistExtras.remove(pae); - mHandler.removeCallbacks(pae); + mUiHandler.removeCallbacks(pae); } return pae.extras; } @@ -10818,7 +10818,7 @@ public final class ActivityManagerService extends ActivityManagerNative activity.app.thread.requestAssistContextExtras(activity.appToken, pae, requestType); mPendingAssistExtras.add(pae); - mHandler.postDelayed(pae, timeout); + mUiHandler.postDelayed(pae, timeout); } catch (RemoteException e) { Slog.w(TAG, "getAssistContextExtras failed: crash calling " + activity); return null; @@ -10875,7 +10875,7 @@ public final class ActivityManagerService extends ActivityManagerNative synchronized (this) { buildAssistBundleLocked(pae, extras); boolean exists = mPendingAssistExtras.remove(pae); - mHandler.removeCallbacks(pae); + mUiHandler.removeCallbacks(pae); if (!exists) { // Timed out. return; @@ -17152,8 +17152,10 @@ public final class ActivityManagerService extends ActivityManagerNative } // Can't call out of the system process with a lock held, so post a message. - mHandler.obtainMessage(SHUTDOWN_UI_AUTOMATION_CONNECTION_MSG, - app.instrumentationUiAutomationConnection).sendToTarget(); + if (app.instrumentationUiAutomationConnection != null) { + mHandler.obtainMessage(SHUTDOWN_UI_AUTOMATION_CONNECTION_MSG, + app.instrumentationUiAutomationConnection).sendToTarget(); + } app.instrumentationWatcher = null; app.instrumentationUiAutomationConnection = null; diff --git a/services/core/java/com/android/server/am/BatteryStatsService.java b/services/core/java/com/android/server/am/BatteryStatsService.java index 9bf4f5f..335288d 100644 --- a/services/core/java/com/android/server/am/BatteryStatsService.java +++ b/services/core/java/com/android/server/am/BatteryStatsService.java @@ -1263,8 +1263,8 @@ public final class BatteryStatsService extends IBatteryStats.Stub Slog.v(TAG, "WiFi energy data was reset, new WiFi energy data is " + result); } - // There is some accuracy error in reports so allow 30 milliseconds of error. - final long SAMPLE_ERROR_MILLIS = 30; + // There is some accuracy error in reports so allow some slop in the results. + final long SAMPLE_ERROR_MILLIS = 750; final long totalTimeMs = result.mControllerIdleTimeMs + result.mControllerRxTimeMs + result.mControllerTxTimeMs; if (totalTimeMs > timePeriodMs + SAMPLE_ERROR_MILLIS) { diff --git a/services/core/java/com/android/server/am/BroadcastQueue.java b/services/core/java/com/android/server/am/BroadcastQueue.java index a956c56..960cbf1 100644 --- a/services/core/java/com/android/server/am/BroadcastQueue.java +++ b/services/core/java/com/android/server/am/BroadcastQueue.java @@ -509,7 +509,7 @@ public final class BroadcastQueue { break; } int appOp = AppOpsManager.permissionToOpCode(requiredPermission); - if (appOp != r.appOp + if (appOp != AppOpsManager.OP_NONE && appOp != r.appOp && mService.mAppOpsService.noteOperation(appOp, filter.receiverList.uid, filter.packageName) != AppOpsManager.MODE_ALLOWED) { diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index f67f3f3..c650b6d 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -4230,16 +4230,18 @@ public class PackageManagerService extends IPackageManager.Stub { if (ri != null) { return ri; } + ri = new ResolveInfo(mResolveInfo); + ri.activityInfo = new ActivityInfo(ri.activityInfo); + ri.activityInfo.applicationInfo = new ApplicationInfo( + ri.activityInfo.applicationInfo); if (userId != 0) { - ri = new ResolveInfo(mResolveInfo); - ri.activityInfo = new ActivityInfo(ri.activityInfo); - ri.activityInfo.applicationInfo = new ApplicationInfo( - ri.activityInfo.applicationInfo); ri.activityInfo.applicationInfo.uid = UserHandle.getUid(userId, UserHandle.getAppId(ri.activityInfo.applicationInfo.uid)); - return ri; } - return mResolveInfo; + // Make sure that the resolver is displayable in car mode + if (ri.activityInfo.metaData == null) ri.activityInfo.metaData = new Bundle(); + ri.activityInfo.metaData.putBoolean(Intent.METADATA_DOCK_HOME, true); + return ri; } } return null; @@ -4626,7 +4628,7 @@ public class PackageManagerService extends IPackageManager.Stub { if (result == null) { result = new CrossProfileDomainInfo(); result.resolveInfo = - createForwardingResolveInfo(null, sourceUserId, parentUserId); + createForwardingResolveInfo(new IntentFilter(), sourceUserId, parentUserId); result.bestDomainVerificationStatus = status; } else { result.bestDomainVerificationStatus = bestDomainVerificationStatus(status, @@ -13600,9 +13602,14 @@ public class PackageManagerService extends IPackageManager.Stub { libDirRoot = ps.legacyNativeLibraryPathString; } if (p != null && (isExternal(p) || p.isForwardLocked())) { - String secureContainerId = cidFromCodePath(p.applicationInfo.getBaseCodePath()); - if (secureContainerId != null) { - asecPath = PackageHelper.getSdFilesystem(secureContainerId); + final long token = Binder.clearCallingIdentity(); + try { + String secureContainerId = cidFromCodePath(p.applicationInfo.getBaseCodePath()); + if (secureContainerId != null) { + asecPath = PackageHelper.getSdFilesystem(secureContainerId); + } + } finally { + Binder.restoreCallingIdentity(token); } } } diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index ab56d5e..726d29d 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -1589,8 +1589,6 @@ class WindowStateAnimator { final int left = ((int) shownFrame.left) - attrs.surfaceInsets.left; final int top = ((int) shownFrame.top) - attrs.surfaceInsets.top; if (mSurfaceX != left || mSurfaceY != top) { - mSurfaceX = left; - mSurfaceY = top; if (mAnimating) { // If this window (or its app token) is animating, then the position // of the surface will be re-computed on the next animation frame. @@ -1598,6 +1596,8 @@ class WindowStateAnimator { // transformation is being applied by the animation. return; } + mSurfaceX = left; + mSurfaceY = top; if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG, ">>> OPEN TRANSACTION setWallpaperOffset"); SurfaceControl.openTransaction(); try { |