Merge "Post the starting of the Notification dialog" into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
466dcdd650
@@ -59,6 +59,8 @@ import android.content.pm.PackageManagerInternal.PackageListObserver;
|
|||||||
import android.content.pm.PermissionInfo;
|
import android.content.pm.PermissionInfo;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
@@ -160,11 +162,13 @@ public final class PermissionPolicyService extends SystemService {
|
|||||||
private NotificationManagerInternal mNotificationManager;
|
private NotificationManagerInternal mNotificationManager;
|
||||||
private final KeyguardManager mKeyguardManager;
|
private final KeyguardManager mKeyguardManager;
|
||||||
private final PackageManager mPackageManager;
|
private final PackageManager mPackageManager;
|
||||||
|
private final Handler mHandler;
|
||||||
|
|
||||||
public PermissionPolicyService(@NonNull Context context) {
|
public PermissionPolicyService(@NonNull Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
mHandler = new Handler(Looper.getMainLooper());
|
||||||
mPackageManager = context.getPackageManager();
|
mPackageManager = context.getPackageManager();
|
||||||
mKeyguardManager = context.getSystemService(KeyguardManager.class);
|
mKeyguardManager = context.getSystemService(KeyguardManager.class);
|
||||||
LocalServices.addService(PermissionPolicyInternal.class, new Internal());
|
LocalServices.addService(PermissionPolicyInternal.class, new Internal());
|
||||||
@@ -1068,8 +1072,11 @@ public final class PermissionPolicyService extends SystemService {
|
|||||||
activityInfo.packageName, user)) {
|
activityInfo.packageName, user)) {
|
||||||
clearNotificationReviewFlagsIfNeeded(activityInfo.packageName, user);
|
clearNotificationReviewFlagsIfNeeded(activityInfo.packageName, user);
|
||||||
} else {
|
} else {
|
||||||
showNotificationPromptIfNeeded(activityInfo.packageName,
|
// Post the activity start checks to ensure the notification channel
|
||||||
taskInfo.userId, taskInfo.taskId, info);
|
// checks happen outside the WindowManager global lock.
|
||||||
|
mHandler.post(() -> showNotificationPromptIfNeeded(
|
||||||
|
activityInfo.packageName, taskInfo.userId, taskInfo.taskId,
|
||||||
|
info));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ import java.lang.annotation.Retention;
|
|||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback to intercept activity starts and possibly block/redirect them.
|
* Callback to intercept activity starts and possibly block/redirect them. The callback methods will
|
||||||
|
* be called with the WindowManagerGlobalLock held.
|
||||||
*/
|
*/
|
||||||
public abstract class ActivityInterceptorCallback {
|
public abstract class ActivityInterceptorCallback {
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user