Merge "Add overlays for nav bar interaction mode."

This commit is contained in:
Winson Chung
2019-03-22 21:02:07 +00:00
committed by Android (Google) Code Review
17 changed files with 393 additions and 2 deletions

View File

@@ -54,6 +54,16 @@ public interface WindowManagerPolicyConstants {
int NAV_BAR_RIGHT = 1 << 1;
int NAV_BAR_BOTTOM = 1 << 2;
// Navigation bar interaction modes
int NAV_BAR_MODE_3BUTTON = 0;
int NAV_BAR_MODE_2BUTTON = 1;
int NAV_BAR_MODE_GESTURAL = 2;
// Associated overlays for each nav bar mode
String NAV_BAR_MODE_3BUTTON_OVERLAY = "com.android.internal.systemui.navbar.threebutton";
String NAV_BAR_MODE_2BUTTON_OVERLAY = "com.android.internal.systemui.navbar.twobutton";
String NAV_BAR_MODE_GESTURAL_OVERLAY = "com.android.internal.systemui.navbar.gestural";
/**
* Broadcast sent when a user activity is detected.
*/

View File

@@ -3222,6 +3222,12 @@
-->
<integer name="config_navBarOpacityMode">0</integer>
<!-- Controls the navigation bar interaction mode:
0: 3 button mode (back, home, overview buttons)
1: 2 button mode (back, home buttons + swipe up for overview)
2: gestures only for back, home and overview -->
<integer name="config_navBarInteractionMode">0</integer>
<!-- Default insets [LEFT/RIGHTxTOP/BOTTOM] from the screen edge for picture-in-picture windows.
These values are in DPs and will be converted to pixel sizes internally. -->
<string translatable="false" name="config_defaultPictureInPictureScreenEdgeInsets">16x16</string>

View File

@@ -2832,6 +2832,7 @@
<java-symbol type="string" name="config_packagedKeyboardName" />
<java-symbol type="bool" name="config_forceWindowDrawsStatusBarBackground" />
<java-symbol type="integer" name="config_navBarOpacityMode" />
<java-symbol type="integer" name="config_navBarInteractionMode" />
<java-symbol type="color" name="system_bar_background_semi_transparent" />
<!-- EditText suggestion popup. -->

View File

@@ -19,6 +19,12 @@ package com.android.providers.settings;
import static android.os.Process.ROOT_UID;
import static android.os.Process.SHELL_UID;
import static android.os.Process.SYSTEM_UID;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON_OVERLAY;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY;
import android.Manifest;
import android.annotation.NonNull;
@@ -33,6 +39,8 @@ import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.om.IOverlayManager;
import android.content.om.OverlayInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageManager;
import android.content.pm.PackageInfo;
@@ -3235,7 +3243,7 @@ public class SettingsProvider extends ContentProvider {
}
private final class UpgradeController {
private static final int SETTINGS_VERSION = 176;
private static final int SETTINGS_VERSION = 177;
private final int mUserId;
@@ -4311,6 +4319,57 @@ public class SettingsProvider extends ContentProvider {
currentVersion = 176;
}
if (currentVersion == 176) {
// Version 176: Migrate the existing swipe up setting into the resource overlay
// for the navigation bar interaction mode.
final IOverlayManager overlayManager = IOverlayManager.Stub.asInterface(
ServiceManager.getService(Context.OVERLAY_SERVICE));
int navBarMode = -1;
// Migrate the swipe up setting only if it is set
final SettingsState secureSettings = getSecureSettingsLocked(userId);
final Setting swipeUpSetting = secureSettings.getSettingLocked(
Secure.SWIPE_UP_TO_SWITCH_APPS_ENABLED);
if (swipeUpSetting != null && !swipeUpSetting.isNull()) {
navBarMode = swipeUpSetting.getValue().equals("1")
? NAV_BAR_MODE_2BUTTON
: NAV_BAR_MODE_3BUTTON;
}
// Temporary: Only for migration for dogfooders, to be removed
try {
final OverlayInfo info = overlayManager.getOverlayInfo(
"com.android.internal.experiment.navbar.type.inset",
UserHandle.USER_CURRENT);
if (info != null && info.isEnabled()) {
navBarMode = NAV_BAR_MODE_GESTURAL;
}
} catch (RemoteException e) {
// Ingore, fall through
}
if (navBarMode != -1) {
try {
overlayManager.setEnabled(NAV_BAR_MODE_3BUTTON_OVERLAY,
navBarMode == NAV_BAR_MODE_3BUTTON,
UserHandle.USER_CURRENT);
overlayManager.setEnabled(NAV_BAR_MODE_2BUTTON_OVERLAY,
navBarMode == NAV_BAR_MODE_2BUTTON,
UserHandle.USER_CURRENT);
overlayManager.setEnabled(NAV_BAR_MODE_GESTURAL_OVERLAY,
navBarMode == NAV_BAR_MODE_GESTURAL,
UserHandle.USER_CURRENT);
} catch (RemoteException e) {
throw new IllegalStateException(
"Failed to set nav bar interaction mode overlay");
}
}
currentVersion = 177;
}
// vXXX: Add new settings above this point.
if (currentVersion != newVersion) {

View File

@@ -39,7 +39,10 @@ LOCAL_REQUIRED_MODULES := \
IconShapeRoundedRectOverlay \
IconShapeSquareOverlay \
IconShapeSquircleOverlay \
IconShapeTeardropOverlay
IconShapeTeardropOverlay \
NavigationBarMode3ButtonOverlay \
NavigationBarMode2ButtonOverlay \
NavigationBarModeGesturalOverlay
include $(BUILD_PHONY_PACKAGE)
include $(CLEAR_VARS)

View File

@@ -0,0 +1,30 @@
#
# Copyright 2018, The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_RRO_THEME := NavigationBarMode2Button
LOCAL_CERTIFICATE := platform
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_PACKAGE_NAME := NavigationBarMode2ButtonOverlay
LOCAL_SDK_VERSION := current
include $(BUILD_RRO_PACKAGE)

View File

@@ -0,0 +1,27 @@
<!--
/**
* Copyright (c) 2018, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.internal.systemui.navbar.twobutton"
android:versionCode="1"
android:versionName="1.0">
<overlay android:targetPackage="android"
android:category="com.android.internal.navigation_bar_mode"
android:priority="1"/>
<application android:label="@string/navigation_bar_mode_title" android:hasCode="false"/>
</manifest>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright (c) 2019, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<resources>
<!-- Controls the navigation bar interaction mode:
0: 3 button mode (back, home, overview buttons)
1: 2 button mode (back, home buttons + swipe up for overview)
2: gestures only for back, home and overview -->
<integer name="config_navBarInteractionMode">1</integer>
</resources>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright (c) 2018, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Name of overlay [CHAR LIMIT=64] -->
<string name="navigation_bar_mode_title" translatable="false">2 Button Navigation Bar</string>
</resources>

View File

@@ -0,0 +1,30 @@
#
# Copyright 2018, The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_RRO_THEME := NavigationBarMode3Button
LOCAL_CERTIFICATE := platform
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_PACKAGE_NAME := NavigationBarMode3ButtonOverlay
LOCAL_SDK_VERSION := current
include $(BUILD_RRO_PACKAGE)

View File

@@ -0,0 +1,27 @@
<!--
/**
* Copyright (c) 2018, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.internal.systemui.navbar.threebutton"
android:versionCode="1"
android:versionName="1.0">
<overlay android:targetPackage="android"
android:category="com.android.internal.navigation_bar_mode"
android:priority="1"/>
<application android:label="@string/navigation_bar_mode_title" android:hasCode="false"/>
</manifest>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright (c) 2019, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<resources>
<!-- Controls the navigation bar interaction mode:
0: 3 button mode (back, home, overview buttons)
1: 2 button mode (back, home buttons + swipe up for overview)
2: gestures only for back, home and overview -->
<integer name="config_navBarInteractionMode">0</integer>
</resources>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright (c) 2018, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Name of overlay [CHAR LIMIT=64] -->
<string name="navigation_bar_mode_title" translatable="false">3 Button Navigation Bar</string>
</resources>

View File

@@ -0,0 +1,30 @@
#
# Copyright 2018, The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_RRO_THEME := NavigationBarModeGestural
LOCAL_CERTIFICATE := platform
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_PACKAGE_NAME := NavigationBarModeGesturalOverlay
LOCAL_SDK_VERSION := current
include $(BUILD_RRO_PACKAGE)

View File

@@ -0,0 +1,27 @@
<!--
/**
* Copyright (c) 2018, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.internal.systemui.navbar.gestural"
android:versionCode="1"
android:versionName="1.0">
<overlay android:targetPackage="android"
android:category="com.android.internal.navigation_bar_mode"
android:priority="1"/>
<application android:label="@string/navigation_bar_mode_title" android:hasCode="false"/>
</manifest>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright (c) 2019, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<resources>
<!-- Controls the navigation bar interaction mode:
0: 3 button mode (back, home, overview buttons)
1: 2 button mode (back, home buttons + swipe up for overview)
2: gestures only for back, home and overview -->
<integer name="config_navBarInteractionMode">2</integer>
</resources>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright (c) 2018, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Name of overlay [CHAR LIMIT=64] -->
<string name="navigation_bar_mode_title" translatable="false">Gestural Navigation Bar</string>
</resources>