diff --git a/res/values-bs/strings.xml b/res/values-bs/strings.xml index c497d24b657..ded32766b5e 100644 --- a/res/values-bs/strings.xml +++ b/res/values-bs/strings.xml @@ -2227,7 +2227,7 @@ "Prozirnost teksta" "Boja rubova" "Vrsta rubova" - "Skup fontova" + "Porodica fontova" "Stilovi će izgledati ovako" "Aa" "Zadano" diff --git a/res/values-in/strings.xml b/res/values-in/strings.xml index 5acb3cb193b..c50559c8da1 100644 --- a/res/values-in/strings.xml +++ b/res/values-in/strings.xml @@ -3149,7 +3149,7 @@ "tantangan kerja, kerja, profil" "profil kerja, profil yang dikelola, menyatukan, penyatuan, kerja, profil" "gestur" - "bayar, tap, pembayaran" + "bayar, tempel, pembayaran" "backup, back up" "gestur" "wajah, buka kunci, autentikasi, login" diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index 3a403ce4b9b..e37b8b65dfa 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -3157,7 +3157,7 @@ "网络, 移动网络状态, 服务状态, 信号强度, 移动网络类型, 漫游, iccid, eid" "序列号, 硬件版本" "Android 安全补丁程序级别, 基带版本, 内核版本" - "主题背景, 浅色, 夜间, 模式" + "主题背景, 光亮, 暗黑, 模式" "深色主题背景" "错误" "主动显示, 锁定屏幕显示" diff --git a/src/com/android/settings/gestures/GestureNavigationNotAvailableDialog.java b/src/com/android/settings/gestures/GestureNavigationNotAvailableDialog.java deleted file mode 100644 index 6e8b4142d8b..00000000000 --- a/src/com/android/settings/gestures/GestureNavigationNotAvailableDialog.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 - */ - -package com.android.settings.gestures; - -import android.app.AlertDialog; -import android.app.Dialog; -import android.app.settings.SettingsEnums; -import android.content.Context; -import android.os.Bundle; - -import com.android.settings.R; -import com.android.settings.core.instrumentation.InstrumentedDialogFragment; - -/** - * Dialog to notify user that gesture navigation is not available because of unsupported launcher. - */ -public class GestureNavigationNotAvailableDialog extends InstrumentedDialogFragment { - private static final String TAG = "GestureNavigationNotAvailableDialog"; - - public static void show(SystemNavigationGestureSettings parent) { - if (!parent.isAdded()) { - return; - } - - final GestureNavigationNotAvailableDialog dialog = - new GestureNavigationNotAvailableDialog(); - dialog.setTargetFragment(parent, 0); - dialog.show(parent.getFragmentManager(), TAG); - } - - @Override - public int getMetricsCategory() { - return SettingsEnums.SETTINGS_GESTURE_NAV_NOT_AVAILABLE_DLG; - } - - @Override - public Dialog onCreateDialog(Bundle savedInstanceState) { - final Context context = getActivity(); - final String defaultHomeAppName = SystemNavigationPreferenceController - .getDefaultHomeAppName(context); - final String message = getString(R.string.gesture_not_supported_dialog_message, - defaultHomeAppName); - return new AlertDialog.Builder(context) - .setMessage(message) - .setPositiveButton(R.string.okay, null) - .create(); - } -} \ No newline at end of file diff --git a/src/com/android/settings/gestures/SystemNavigationGestureSettings.java b/src/com/android/settings/gestures/SystemNavigationGestureSettings.java index b3d090d75f2..3def7804bb5 100644 --- a/src/com/android/settings/gestures/SystemNavigationGestureSettings.java +++ b/src/com/android/settings/gestures/SystemNavigationGestureSettings.java @@ -22,7 +22,6 @@ import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVE import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY; import static com.android.settings.widget.RadioButtonPreferenceWithExtraWidget.EXTRA_WIDGET_VISIBILITY_GONE; -import static com.android.settings.widget.RadioButtonPreferenceWithExtraWidget.EXTRA_WIDGET_VISIBILITY_INFO; import static com.android.settings.widget.RadioButtonPreferenceWithExtraWidget.EXTRA_WIDGET_VISIBILITY_SETTING; import android.accessibilityservice.AccessibilityServiceInfo; @@ -160,17 +159,9 @@ public class SystemNavigationGestureSettings extends RadioButtonPickerFragment { RadioButtonPreferenceWithExtraWidget p = (RadioButtonPreferenceWithExtraWidget) pref; if (info.getKey() == KEY_SYSTEM_NAV_GESTURAL) { - if (SystemNavigationPreferenceController.isGestureNavSupportedByDefaultLauncher( - getContext())) { - p.setExtraWidgetVisibility(EXTRA_WIDGET_VISIBILITY_SETTING); - p.setExtraWidgetOnClickListener((v) -> GestureNavigationBackSensitivityDialog - .show(this, getBackSensitivity(getContext(), mOverlayManager))); - } else { - p.setEnabled(false); - p.setExtraWidgetVisibility(EXTRA_WIDGET_VISIBILITY_INFO); - p.setExtraWidgetOnClickListener((v) -> - GestureNavigationNotAvailableDialog.show(this)); - } + p.setExtraWidgetVisibility(EXTRA_WIDGET_VISIBILITY_SETTING); + p.setExtraWidgetOnClickListener((v) -> GestureNavigationBackSensitivityDialog + .show(this, getBackSensitivity(getContext(), mOverlayManager))); } else { p.setExtraWidgetVisibility(EXTRA_WIDGET_VISIBILITY_GONE); } @@ -219,12 +210,6 @@ public class SystemNavigationGestureSettings extends RadioButtonPickerFragment { @Override protected boolean setDefaultKey(String key) { final Context c = getContext(); - if (key == KEY_SYSTEM_NAV_GESTURAL && - !SystemNavigationPreferenceController.isGestureNavSupportedByDefaultLauncher(c)) { - // This should not happen since the preference is disabled. Return to be safe. - return false; - } - setCurrentSystemNavigationMode(c, mOverlayManager, key); setIllustrationVideo(mVideoPreference, key); if (TextUtils.equals(KEY_SYSTEM_NAV_GESTURAL, key) && ( diff --git a/src/com/android/settings/gestures/SystemNavigationPreferenceController.java b/src/com/android/settings/gestures/SystemNavigationPreferenceController.java index a151dc1746c..d0d81552ff5 100644 --- a/src/com/android/settings/gestures/SystemNavigationPreferenceController.java +++ b/src/com/android/settings/gestures/SystemNavigationPreferenceController.java @@ -22,14 +22,11 @@ import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL; import android.content.ComponentName; import android.content.Context; import android.content.Intent; -import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import com.android.settings.R; import com.android.settings.core.BasePreferenceController; -import java.util.ArrayList; - public class SystemNavigationPreferenceController extends BasePreferenceController { static final String PREF_KEY_SYSTEM_NAVIGATION = "gesture_system_navigation"; @@ -101,31 +98,4 @@ public class SystemNavigationPreferenceController extends BasePreferenceControll return NAV_BAR_MODE_GESTURAL == context.getResources().getInteger( com.android.internal.R.integer.config_navBarInteractionMode); } - - static boolean isGestureNavSupportedByDefaultLauncher(Context context) { - final ComponentName cn = context.getPackageManager().getHomeActivities(new ArrayList<>()); - if (cn == null) { - // There is no default home app set for the current user, don't make any changes yet. - return true; - } - ComponentName recentsComponentName = ComponentName.unflattenFromString(context.getString( - com.android.internal.R.string.config_recentsComponentName)); - return recentsComponentName.getPackageName().equals(cn.getPackageName()); - } - - static String getDefaultHomeAppName(Context context) { - final PackageManager pm = context.getPackageManager(); - final ComponentName cn = pm.getHomeActivities(new ArrayList<>()); - if (cn != null) { - try { - ApplicationInfo ai = pm.getApplicationInfo(cn.getPackageName(), 0); - if (ai != null) { - return pm.getApplicationLabel(ai).toString(); - } - } catch (final PackageManager.NameNotFoundException e) { - // Do nothing - } - } - return ""; - } } diff --git a/tests/robotests/src/com/android/settings/gestures/SystemNavigationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/SystemNavigationPreferenceControllerTest.java index 79f18502c81..3163f9ab801 100644 --- a/tests/robotests/src/com/android/settings/gestures/SystemNavigationPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/gestures/SystemNavigationPreferenceControllerTest.java @@ -24,7 +24,6 @@ import static com.android.settings.gestures.SystemNavigationPreferenceController import static com.google.common.truth.Truth.assertThat; -import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import android.content.ComponentName; @@ -181,46 +180,4 @@ public class SystemNavigationPreferenceControllerTest { assertThat(TextUtils.equals(mController.getSummary(), mContext.getText( com.android.settings.R.string.swipe_up_to_switch_apps_title))).isTrue(); } - - @Test - public void testIsGestureNavSupportedByDefaultLauncher_noDefaultLauncher() { - when(mMockPackageManager.getHomeActivities(any())).thenReturn(null); - assertThat(SystemNavigationPreferenceController - .isGestureNavSupportedByDefaultLauncher(mMockContext)).isTrue(); - } - - @Test - public void testIsGestureNavSupportedByDefaultLauncher_supported() { - when(mMockPackageManager.getHomeActivities(any())).thenReturn( - ComponentName.unflattenFromString(TEST_RECENTS_COMPONENT_NAME)); - assertThat(SystemNavigationPreferenceController - .isGestureNavSupportedByDefaultLauncher(mMockContext)).isTrue(); - } - - @Test - public void testIsGestureNavSupportedByDefaultLauncher_notSupported() { - when(mMockPackageManager.getHomeActivities(any())).thenReturn( - new ComponentName("unsupported", "launcher")); - assertThat(SystemNavigationPreferenceController - .isGestureNavSupportedByDefaultLauncher(mMockContext)).isFalse(); - } - - @Test - public void testGetDefaultHomeAppName_noDefaultLauncher() { - when(mMockPackageManager.getHomeActivities(any())).thenReturn(null); - assertThat(SystemNavigationPreferenceController - .getDefaultHomeAppName(mMockContext)).isEqualTo(""); - } - - @Test - public void testGetDefaultHomeAppName_defaultLauncherExists() throws Exception { - when(mMockPackageManager.getHomeActivities(any())).thenReturn( - new ComponentName("supported", "launcher")); - ApplicationInfo info = new ApplicationInfo(); - when(mMockPackageManager.getApplicationInfo("supported", 0)).thenReturn(info); - when(mMockPackageManager.getApplicationLabel(info)).thenReturn("Test Home App"); - - assertThat(SystemNavigationPreferenceController - .getDefaultHomeAppName(mMockContext)).isEqualTo("Test Home App"); - } } \ No newline at end of file