Clear calling identity before calling into AMS
Clear calling identity before calling into AMS in unhibernatePackageForUser() to make sure we are calling as system user and avoid security exception Bug: 186701008 Test: built and flashed to wembley device, then run adb shell cmd app_hibernation set-state PACKAGE_NAME false. No exceptions found. Test: atest AppHibernationServiceTest Change-Id: Icf0c72b85f4c611c84129a6fb9425f4344b4681b
This commit is contained in:
@@ -393,6 +393,7 @@ public final class AppHibernationService extends SystemService {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "unhibernatePackage");
|
||||
pkgState.hibernated = false;
|
||||
pkgState.lastUnhibernatedMs = System.currentTimeMillis();
|
||||
final long caller = Binder.clearCallingIdentity();
|
||||
// Deliver LOCKED_BOOT_COMPLETE AND BOOT_COMPLETE broadcast so app can re-register
|
||||
// their alarms/jobs/etc.
|
||||
try {
|
||||
@@ -435,8 +436,10 @@ public final class AppHibernationService extends SystemService {
|
||||
userId);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(caller);
|
||||
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
||||
}
|
||||
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user