summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tracy Zhou <tracyzhou@google.com> 2018-02-23 03:51:02 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-02-23 03:51:02 +0000
commit25cb15dcd9d16ec023990cc9beb5c6fc1bbd2c4c (patch)
tree15a37e79e4fce46d146224ccb2307e886d3abbf5
parent6fb936f814ef2e665b480b1a444174c8b90c3ccb (diff)
parent0f6525db845e015b513b562009ee7eefcc34b681 (diff)
Merge "Dismiss PIP window when PIP is disabled from settings."
-rw-r--r--packages/SystemUI/src/com/android/systemui/pip/phone/PipAppOpsListener.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipAppOpsListener.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipAppOpsListener.java
index f0e4ccc139ca..1e0d4d01f167 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipAppOpsListener.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipAppOpsListener.java
@@ -26,12 +26,14 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager.NameNotFoundException;
+import android.os.Handler;
import android.util.Pair;
public class PipAppOpsListener {
private static final String TAG = PipAppOpsListener.class.getSimpleName();
private Context mContext;
+ private Handler mHandler;
private IActivityManager mActivityManager;
private AppOpsManager mAppOpsManager;
@@ -50,7 +52,7 @@ public class PipAppOpsListener {
if (appInfo.packageName.equals(topPipActivityInfo.first.getPackageName()) &&
mAppOpsManager.checkOpNoThrow(OP_PICTURE_IN_PICTURE, appInfo.uid,
packageName) != MODE_ALLOWED) {
- mMotionHelper.dismissPip();
+ mHandler.post(() -> mMotionHelper.dismissPip());
}
}
} catch (NameNotFoundException e) {
@@ -63,6 +65,7 @@ public class PipAppOpsListener {
public PipAppOpsListener(Context context, IActivityManager activityManager,
PipMotionHelper motionHelper) {
mContext = context;
+ mHandler = new Handler(mContext.getMainLooper());
mActivityManager = activityManager;
mAppOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
mMotionHelper = motionHelper;