TEMP: Delay start of Legacy Permission Dialog by 200ms
This reduces the chances of an animation bug when launching Bug: 222757698 Test: manual Change-Id: I3eca5a377131fd7dd77c9c5bf5f15135c9548a5e
This commit is contained in:
@@ -54,6 +54,8 @@ import android.content.pm.PackageManagerInternal.PackageListObserver;
|
||||
import android.content.pm.PermissionInfo;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
@@ -109,6 +111,7 @@ public final class PermissionPolicyService extends SystemService {
|
||||
private static final String SYSTEM_PKG = "android";
|
||||
private static final boolean DEBUG = false;
|
||||
private static final long USER_SENSITIVE_UPDATE_DELAY_MS = 60000;
|
||||
private static final long ACTIVITY_START_DELAY_MS = 200;
|
||||
|
||||
private final Object mLock = new Object();
|
||||
|
||||
@@ -149,6 +152,7 @@ public final class PermissionPolicyService extends SystemService {
|
||||
private List<String> mAppOpPermissions;
|
||||
|
||||
private Context mContext;
|
||||
private Handler mHandler;
|
||||
private PackageManagerInternal mPackageManagerInternal;
|
||||
private NotificationManagerInternal mNotificationManager;
|
||||
private final KeyguardManager mKeyguardManager;
|
||||
@@ -158,6 +162,7 @@ public final class PermissionPolicyService extends SystemService {
|
||||
super(context);
|
||||
|
||||
mContext = context;
|
||||
mHandler = new Handler(Looper.getMainLooper());
|
||||
mPackageManager = context.getPackageManager();
|
||||
mKeyguardManager = context.getSystemService(KeyguardManager.class);
|
||||
LocalServices.addService(PermissionPolicyInternal.class, new Internal());
|
||||
@@ -1151,7 +1156,8 @@ public final class PermissionPolicyService extends SystemService {
|
||||
options.setTaskOverlay(true, false);
|
||||
options.setLaunchTaskId(taskId);
|
||||
try {
|
||||
mContext.startActivityAsUser(grantPermission, options.toBundle(), user);
|
||||
mHandler.postDelayed(() -> mContext.startActivityAsUser(
|
||||
grantPermission, options.toBundle(), user), ACTIVITY_START_DELAY_MS);
|
||||
} catch (Exception e) {
|
||||
Log.e(LOG_TAG, "couldn't start grant permission dialog"
|
||||
+ "for other package " + pkgName, e);
|
||||
|
||||
Reference in New Issue
Block a user