Merge "Merge "Update sysui for screen pinning with gestural nav" into qt-dev am: 975eea7e98" into qt-dev-plus-aosp

am: b97f906f0d

Change-Id: I1165ad5a7f618aad3146c9974c2139314936a0fe
This commit is contained in:
Winson Chung
2019-04-30 22:09:28 -07:00
committed by android-build-merger
4 changed files with 43 additions and 3 deletions

View File

@@ -1345,6 +1345,7 @@
<!-- Screen pinning dialog description. -->
<string name="screen_pinning_description">This keeps it in view until you unpin. Touch &amp; hold Back and Overview to unpin.</string>
<string name="screen_pinning_description_recents_invisible">This keeps it in view until you unpin. Touch &amp; hold Back and Home to unpin.</string>
<string name="screen_pinning_description_gestural">This keeps it in view until you unpin. Swipe up &amp; hold to unpin.</string>
<!-- Screen pinning dialog description. -->
<string name="screen_pinning_description_accessible">This keeps it in view until you unpin. Touch &amp; hold Overview to unpin.</string>
<string name="screen_pinning_description_recents_invisible_accessible">This keeps it in view until you unpin. Touch &amp; hold Home to unpin.</string>

View File

@@ -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;
}

View File

@@ -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;
@@ -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")) {

View File

@@ -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;
@@ -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;
@@ -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() {
@@ -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();
@@ -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 {
@@ -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);