Merge "Clear calling identity before calling to DeviceIdleController" am: 6216ab81c1 am: bc0f38ed9e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2529739 Change-Id: I3a1406dbc6d4598bba9b871ea2151f22516e36d9 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -969,16 +969,22 @@ public class Vpn {
|
|||||||
// Allow VpnManager app to temporarily run background services to handle this error.
|
// Allow VpnManager app to temporarily run background services to handle this error.
|
||||||
// If an app requires anything beyond this grace period, they MUST either declare
|
// If an app requires anything beyond this grace period, they MUST either declare
|
||||||
// themselves as a foreground service, or schedule a job/workitem.
|
// themselves as a foreground service, or schedule a job/workitem.
|
||||||
DeviceIdleInternal idleController = mDeps.getDeviceIdleInternal();
|
final long token = Binder.clearCallingIdentity();
|
||||||
|
try {
|
||||||
|
final DeviceIdleInternal idleController = mDeps.getDeviceIdleInternal();
|
||||||
idleController.addPowerSaveTempWhitelistApp(Process.myUid(), packageName,
|
idleController.addPowerSaveTempWhitelistApp(Process.myUid(), packageName,
|
||||||
VPN_MANAGER_EVENT_ALLOWLIST_DURATION_MS, mUserId, false, REASON_VPN,
|
VPN_MANAGER_EVENT_ALLOWLIST_DURATION_MS, mUserId, false, REASON_VPN,
|
||||||
"VpnManager event");
|
"VpnManager event");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return mUserIdContext.startService(intent) != null;
|
return mUserIdContext.startService(intent) != null;
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Log.e(TAG, "Service of VpnManager app " + intent + " failed to start", e);
|
Log.e(TAG, "Service of VpnManager app " + intent + " failed to start", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(token);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isVpnApp(String packageName) {
|
private static boolean isVpnApp(String packageName) {
|
||||||
|
|||||||
Reference in New Issue
Block a user