Loading packages/SystemUI/res/values/strings.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1345,6 +1345,7 @@ <!-- Screen pinning dialog description. --> <string name="screen_pinning_description">This keeps it in view until you unpin. Touch & hold Back and Overview to unpin.</string> <string name="screen_pinning_description_recents_invisible">This keeps it in view until you unpin. Touch & hold Back and Home to unpin.</string> <string name="screen_pinning_description_gestural">This keeps it in view until you unpin. Swipe up & hold to unpin.</string> <!-- Screen pinning dialog description. --> <string name="screen_pinning_description_accessible">This keeps it in view until you unpin. Touch & hold Overview to unpin.</string> <string name="screen_pinning_description_recents_invisible_accessible">This keeps it in view until you unpin. Touch & hold Home to unpin.</string> Loading packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -96,4 +96,9 @@ interface ISystemUiProxy { * Notifies that the accessibility button in the system's navigation area has been long clicked */ void notifyAccessibilityButtonLongClicked() = 16; /** * Ends the system screen pinning. */ void stopScreenPinning() = 17; } packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +20 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_N import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING; import android.annotation.FloatRange; import android.app.ActivityTaskManager; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -150,6 +151,25 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis } } @Override public void stopScreenPinning() { if (!verifyCaller("stopScreenPinning")) { return; } long token = Binder.clearCallingIdentity(); try { mHandler.post(() -> { try { ActivityTaskManager.getService().stopSystemLockTaskMode(); } catch (RemoteException e) { Log.e(TAG_OPS, "Failed to stop screen pinning"); } }); } finally { Binder.restoreCallingIdentity(token); } } @Override public void onStatusBarMotionEvent(MotionEvent event) { if (!verifyCaller("onStatusBarMotionEvent")) { Loading packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java +17 −3 Original line number Diff line number Diff line Loading @@ -48,14 +48,17 @@ import android.widget.TextView; import com.android.systemui.Dependency; import com.android.systemui.R; import com.android.systemui.SysUiServiceProvider; import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.WindowManagerWrapper; import com.android.systemui.statusbar.phone.NavigationBarView; import com.android.systemui.statusbar.phone.NavigationModeController; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.util.leak.RotationUtils; import java.util.ArrayList; public class ScreenPinningRequest implements View.OnClickListener { public class ScreenPinningRequest implements View.OnClickListener, NavigationModeController.ModeChangedListener { private final Context mContext; Loading @@ -64,6 +67,7 @@ public class ScreenPinningRequest implements View.OnClickListener { private final OverviewProxyService mOverviewProxyService; private RequestWindowView mRequestWindow; private int mNavBarMode; // Id of task to be pinned or locked. private int taskId; Loading @@ -75,6 +79,7 @@ public class ScreenPinningRequest implements View.OnClickListener { mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); mOverviewProxyService = Dependency.get(OverviewProxyService.class); mNavBarMode = Dependency.get(NavigationModeController.class).addListener(this); } public void clearPrompt() { Loading Loading @@ -103,6 +108,11 @@ public class ScreenPinningRequest implements View.OnClickListener { mWindowManager.addView(mRequestWindow, lp); } @Override public void onNavigationModeChanged(int mode) { mNavBarMode = mode; } public void onConfigurationChanged() { if (mRequestWindow != null) { mRequestWindow.onConfigurationChanged(); Loading Loading @@ -224,7 +234,9 @@ public class ScreenPinningRequest implements View.OnClickListener { mLayout.findViewById(R.id.screen_pinning_text_area) .setLayoutDirection(View.LAYOUT_DIRECTION_LOCALE); View buttons = mLayout.findViewById(R.id.screen_pinning_buttons); if (WindowManagerWrapper.getInstance().hasSoftNavigationBar(mContext.getDisplayId())) { WindowManagerWrapper wm = WindowManagerWrapper.getInstance(); if (!QuickStepContract.isGesturalMode(mNavBarMode) && wm.hasSoftNavigationBar(mContext.getDisplayId())) { buttons.setLayoutDirection(View.LAYOUT_DIRECTION_LOCALE); swapChildrenIfRtlAndVertical(buttons); } else { Loading @@ -248,7 +260,9 @@ public class ScreenPinningRequest implements View.OnClickListener { && navigationBarView.isRecentsButtonVisible(); boolean touchExplorationEnabled = mAccessibilityService.isTouchExplorationEnabled(); int descriptionStringResId; if (recentsVisible) { if (QuickStepContract.isGesturalMode(mNavBarMode)) { descriptionStringResId = R.string.screen_pinning_description_gestural; } else if (recentsVisible) { mLayout.findViewById(R.id.screen_pinning_recents_group).setVisibility(VISIBLE); mLayout.findViewById(R.id.screen_pinning_home_bg_light).setVisibility(INVISIBLE); mLayout.findViewById(R.id.screen_pinning_home_bg).setVisibility(INVISIBLE); Loading Loading
packages/SystemUI/res/values/strings.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1345,6 +1345,7 @@ <!-- Screen pinning dialog description. --> <string name="screen_pinning_description">This keeps it in view until you unpin. Touch & hold Back and Overview to unpin.</string> <string name="screen_pinning_description_recents_invisible">This keeps it in view until you unpin. Touch & hold Back and Home to unpin.</string> <string name="screen_pinning_description_gestural">This keeps it in view until you unpin. Swipe up & hold to unpin.</string> <!-- Screen pinning dialog description. --> <string name="screen_pinning_description_accessible">This keeps it in view until you unpin. Touch & hold Overview to unpin.</string> <string name="screen_pinning_description_recents_invisible_accessible">This keeps it in view until you unpin. Touch & hold Home to unpin.</string> Loading
packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -96,4 +96,9 @@ interface ISystemUiProxy { * Notifies that the accessibility button in the system's navigation area has been long clicked */ void notifyAccessibilityButtonLongClicked() = 16; /** * Ends the system screen pinning. */ void stopScreenPinning() = 17; }
packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +20 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_N import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING; import android.annotation.FloatRange; import android.app.ActivityTaskManager; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -150,6 +151,25 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis } } @Override public void stopScreenPinning() { if (!verifyCaller("stopScreenPinning")) { return; } long token = Binder.clearCallingIdentity(); try { mHandler.post(() -> { try { ActivityTaskManager.getService().stopSystemLockTaskMode(); } catch (RemoteException e) { Log.e(TAG_OPS, "Failed to stop screen pinning"); } }); } finally { Binder.restoreCallingIdentity(token); } } @Override public void onStatusBarMotionEvent(MotionEvent event) { if (!verifyCaller("onStatusBarMotionEvent")) { Loading
packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java +17 −3 Original line number Diff line number Diff line Loading @@ -48,14 +48,17 @@ import android.widget.TextView; import com.android.systemui.Dependency; import com.android.systemui.R; import com.android.systemui.SysUiServiceProvider; import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.WindowManagerWrapper; import com.android.systemui.statusbar.phone.NavigationBarView; import com.android.systemui.statusbar.phone.NavigationModeController; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.util.leak.RotationUtils; import java.util.ArrayList; public class ScreenPinningRequest implements View.OnClickListener { public class ScreenPinningRequest implements View.OnClickListener, NavigationModeController.ModeChangedListener { private final Context mContext; Loading @@ -64,6 +67,7 @@ public class ScreenPinningRequest implements View.OnClickListener { private final OverviewProxyService mOverviewProxyService; private RequestWindowView mRequestWindow; private int mNavBarMode; // Id of task to be pinned or locked. private int taskId; Loading @@ -75,6 +79,7 @@ public class ScreenPinningRequest implements View.OnClickListener { mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); mOverviewProxyService = Dependency.get(OverviewProxyService.class); mNavBarMode = Dependency.get(NavigationModeController.class).addListener(this); } public void clearPrompt() { Loading Loading @@ -103,6 +108,11 @@ public class ScreenPinningRequest implements View.OnClickListener { mWindowManager.addView(mRequestWindow, lp); } @Override public void onNavigationModeChanged(int mode) { mNavBarMode = mode; } public void onConfigurationChanged() { if (mRequestWindow != null) { mRequestWindow.onConfigurationChanged(); Loading Loading @@ -224,7 +234,9 @@ public class ScreenPinningRequest implements View.OnClickListener { mLayout.findViewById(R.id.screen_pinning_text_area) .setLayoutDirection(View.LAYOUT_DIRECTION_LOCALE); View buttons = mLayout.findViewById(R.id.screen_pinning_buttons); if (WindowManagerWrapper.getInstance().hasSoftNavigationBar(mContext.getDisplayId())) { WindowManagerWrapper wm = WindowManagerWrapper.getInstance(); if (!QuickStepContract.isGesturalMode(mNavBarMode) && wm.hasSoftNavigationBar(mContext.getDisplayId())) { buttons.setLayoutDirection(View.LAYOUT_DIRECTION_LOCALE); swapChildrenIfRtlAndVertical(buttons); } else { Loading @@ -248,7 +260,9 @@ public class ScreenPinningRequest implements View.OnClickListener { && navigationBarView.isRecentsButtonVisible(); boolean touchExplorationEnabled = mAccessibilityService.isTouchExplorationEnabled(); int descriptionStringResId; if (recentsVisible) { if (QuickStepContract.isGesturalMode(mNavBarMode)) { descriptionStringResId = R.string.screen_pinning_description_gestural; } else if (recentsVisible) { mLayout.findViewById(R.id.screen_pinning_recents_group).setVisibility(VISIBLE); mLayout.findViewById(R.id.screen_pinning_home_bg_light).setVisibility(INVISIBLE); mLayout.findViewById(R.id.screen_pinning_home_bg).setVisibility(INVISIBLE); Loading