Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipAppOpsListener.kt +9 −2 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import com.android.wm.shell.common.ShellExecutor class PipAppOpsListener( private val mContext: Context, private val mCallback: Callback, private val mMainExecutor: ShellExecutor ) { private val mAppOpsManager: AppOpsManager = checkNotNull( Loading @@ -46,7 +45,9 @@ class PipAppOpsListener( packageName ) != AppOpsManager.MODE_ALLOWED ) { mMainExecutor.execute { mCallback.dismissPip() } mCallback?.let { mMainExecutor.execute { it.dismissPip() } } } } catch (e: PackageManager.NameNotFoundException) { // Unregister the listener if the package can't be found Loading @@ -54,6 +55,12 @@ class PipAppOpsListener( } } private var mCallback: Callback? = null fun setCallback(callback: Callback) { mCallback = callback } fun onActivityPinned(packageName: String) { // Register for changes to the app ops setting for this package while it is in PiP registerAppOpsListener(packageName) Loading libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java +8 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ import com.android.wm.shell.common.TabletopModeController; import com.android.wm.shell.common.TaskStackListenerImpl; import com.android.wm.shell.common.pip.PhonePipKeepClearAlgorithm; import com.android.wm.shell.common.pip.PhoneSizeSpecSource; import com.android.wm.shell.common.pip.PipAppOpsListener; import com.android.wm.shell.common.pip.PipBoundsAlgorithm; import com.android.wm.shell.common.pip.PipBoundsState; import com.android.wm.shell.common.pip.PipDisplayLayoutState; Loading Loading @@ -531,6 +532,13 @@ public abstract class WMShellBaseModule { pipKeepClearAlgorithm, pipDisplayLayoutState, sizeSpecSource); } @WMSingleton @Provides static PipAppOpsListener providePipAppOpsListener(Context context, @ShellMainThread ShellExecutor mainExecutor) { return new PipAppOpsListener(context, mainExecutor); } // // Bubbles (optional feature) // Loading libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/Pip1Module.java +0 −8 Original line number Diff line number Diff line Loading @@ -201,14 +201,6 @@ public abstract class Pip1Module { homeTransitionObserver, splitScreenOptional); } @WMSingleton @Provides static PipAppOpsListener providePipAppOpsListener(Context context, PipTouchHandler pipTouchHandler, @ShellMainThread ShellExecutor mainExecutor) { return new PipAppOpsListener(context, pipTouchHandler.getMotionHelper(), mainExecutor); } @WMSingleton @Provides static PipMotionHelper providePipMotionHelper(Context context, Loading libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/Pip2Module.java +3 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import com.android.wm.shell.common.FloatingContentCoordinator; import com.android.wm.shell.common.ShellExecutor; import com.android.wm.shell.common.SystemWindows; import com.android.wm.shell.common.TaskStackListenerImpl; import com.android.wm.shell.common.pip.PipAppOpsListener; import com.android.wm.shell.common.pip.PipBoundsAlgorithm; import com.android.wm.shell.common.pip.PipBoundsState; import com.android.wm.shell.common.pip.PipDisplayLayoutState; Loading Loading @@ -113,6 +114,7 @@ public abstract class Pip2Module { ShellTaskOrganizer shellTaskOrganizer, PipTransitionState pipTransitionState, PipTouchHandler pipTouchHandler, PipAppOpsListener pipAppOpsListener, @ShellMainThread ShellExecutor mainExecutor) { if (!PipUtils.isPip2ExperimentEnabled()) { return Optional.empty(); Loading @@ -121,7 +123,7 @@ public abstract class Pip2Module { context, shellInit, shellCommandHandler, shellController, displayController, displayInsetsController, pipBoundsState, pipBoundsAlgorithm, pipDisplayLayoutState, pipScheduler, taskStackListener, shellTaskOrganizer, pipTransitionState, pipTouchHandler, mainExecutor)); pipTransitionState, pipTouchHandler, pipAppOpsListener, mainExecutor)); } } Loading libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/TvPipModule.java +0 −8 Original line number Diff line number Diff line Loading @@ -233,12 +233,4 @@ public abstract class TvPipModule { static PipParamsChangedForwarder providePipParamsChangedForwarder() { return new PipParamsChangedForwarder(); } @WMSingleton @Provides static PipAppOpsListener providePipAppOpsListener(Context context, PipTaskOrganizer pipTaskOrganizer, @ShellMainThread ShellExecutor mainExecutor) { return new PipAppOpsListener(context, pipTaskOrganizer::removePip, mainExecutor); } } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipAppOpsListener.kt +9 −2 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import com.android.wm.shell.common.ShellExecutor class PipAppOpsListener( private val mContext: Context, private val mCallback: Callback, private val mMainExecutor: ShellExecutor ) { private val mAppOpsManager: AppOpsManager = checkNotNull( Loading @@ -46,7 +45,9 @@ class PipAppOpsListener( packageName ) != AppOpsManager.MODE_ALLOWED ) { mMainExecutor.execute { mCallback.dismissPip() } mCallback?.let { mMainExecutor.execute { it.dismissPip() } } } } catch (e: PackageManager.NameNotFoundException) { // Unregister the listener if the package can't be found Loading @@ -54,6 +55,12 @@ class PipAppOpsListener( } } private var mCallback: Callback? = null fun setCallback(callback: Callback) { mCallback = callback } fun onActivityPinned(packageName: String) { // Register for changes to the app ops setting for this package while it is in PiP registerAppOpsListener(packageName) Loading
libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java +8 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ import com.android.wm.shell.common.TabletopModeController; import com.android.wm.shell.common.TaskStackListenerImpl; import com.android.wm.shell.common.pip.PhonePipKeepClearAlgorithm; import com.android.wm.shell.common.pip.PhoneSizeSpecSource; import com.android.wm.shell.common.pip.PipAppOpsListener; import com.android.wm.shell.common.pip.PipBoundsAlgorithm; import com.android.wm.shell.common.pip.PipBoundsState; import com.android.wm.shell.common.pip.PipDisplayLayoutState; Loading Loading @@ -531,6 +532,13 @@ public abstract class WMShellBaseModule { pipKeepClearAlgorithm, pipDisplayLayoutState, sizeSpecSource); } @WMSingleton @Provides static PipAppOpsListener providePipAppOpsListener(Context context, @ShellMainThread ShellExecutor mainExecutor) { return new PipAppOpsListener(context, mainExecutor); } // // Bubbles (optional feature) // Loading
libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/Pip1Module.java +0 −8 Original line number Diff line number Diff line Loading @@ -201,14 +201,6 @@ public abstract class Pip1Module { homeTransitionObserver, splitScreenOptional); } @WMSingleton @Provides static PipAppOpsListener providePipAppOpsListener(Context context, PipTouchHandler pipTouchHandler, @ShellMainThread ShellExecutor mainExecutor) { return new PipAppOpsListener(context, pipTouchHandler.getMotionHelper(), mainExecutor); } @WMSingleton @Provides static PipMotionHelper providePipMotionHelper(Context context, Loading
libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/Pip2Module.java +3 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import com.android.wm.shell.common.FloatingContentCoordinator; import com.android.wm.shell.common.ShellExecutor; import com.android.wm.shell.common.SystemWindows; import com.android.wm.shell.common.TaskStackListenerImpl; import com.android.wm.shell.common.pip.PipAppOpsListener; import com.android.wm.shell.common.pip.PipBoundsAlgorithm; import com.android.wm.shell.common.pip.PipBoundsState; import com.android.wm.shell.common.pip.PipDisplayLayoutState; Loading Loading @@ -113,6 +114,7 @@ public abstract class Pip2Module { ShellTaskOrganizer shellTaskOrganizer, PipTransitionState pipTransitionState, PipTouchHandler pipTouchHandler, PipAppOpsListener pipAppOpsListener, @ShellMainThread ShellExecutor mainExecutor) { if (!PipUtils.isPip2ExperimentEnabled()) { return Optional.empty(); Loading @@ -121,7 +123,7 @@ public abstract class Pip2Module { context, shellInit, shellCommandHandler, shellController, displayController, displayInsetsController, pipBoundsState, pipBoundsAlgorithm, pipDisplayLayoutState, pipScheduler, taskStackListener, shellTaskOrganizer, pipTransitionState, pipTouchHandler, mainExecutor)); pipTransitionState, pipTouchHandler, pipAppOpsListener, mainExecutor)); } } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/TvPipModule.java +0 −8 Original line number Diff line number Diff line Loading @@ -233,12 +233,4 @@ public abstract class TvPipModule { static PipParamsChangedForwarder providePipParamsChangedForwarder() { return new PipParamsChangedForwarder(); } @WMSingleton @Provides static PipAppOpsListener providePipAppOpsListener(Context context, PipTaskOrganizer pipTaskOrganizer, @ShellMainThread ShellExecutor mainExecutor) { return new PipAppOpsListener(context, pipTaskOrganizer::removePip, mainExecutor); } }