Snap for 5746716 from 66b0cabf26
to qt-c2f2-release
Change-Id: I04433ff2076c1e2f2499b29793541c4a822a1c02
This commit is contained in:
@@ -2227,7 +2227,7 @@
|
||||
<string name="captioning_foreground_opacity" msgid="4370967856995419788">"Prozirnost teksta"</string>
|
||||
<string name="captioning_edge_color" msgid="3670094753735263238">"Boja rubova"</string>
|
||||
<string name="captioning_edge_type" msgid="5997247394951682154">"Vrsta rubova"</string>
|
||||
<string name="captioning_typeface" msgid="1826169240566563259">"Skup fontova"</string>
|
||||
<string name="captioning_typeface" msgid="1826169240566563259">"Porodica fontova"</string>
|
||||
<string name="captioning_preview_text" msgid="4067935959797375065">"Stilovi će izgledati ovako"</string>
|
||||
<string name="captioning_preview_characters" msgid="7105909138497851769">"Aa"</string>
|
||||
<string name="locale_default" msgid="2593883646136326969">"Zadano"</string>
|
||||
|
@@ -3149,7 +3149,7 @@
|
||||
<string name="keywords_profile_challenge" msgid="789611397846512845">"tantangan kerja, kerja, profil"</string>
|
||||
<string name="keywords_unification" msgid="1922900767659821025">"profil kerja, profil yang dikelola, menyatukan, penyatuan, kerja, profil"</string>
|
||||
<string name="keywords_gesture" msgid="3526905012224714078">"gestur"</string>
|
||||
<string name="keywords_payment_settings" msgid="5220104934130446416">"bayar, tap, pembayaran"</string>
|
||||
<string name="keywords_payment_settings" msgid="5220104934130446416">"bayar, tempel, pembayaran"</string>
|
||||
<string name="keywords_backup" msgid="470070289135403022">"backup, back up"</string>
|
||||
<string name="keywords_assist_gesture_launch" msgid="813968759791342591">"gestur"</string>
|
||||
<string name="keywords_face_unlock" msgid="254144854349092754">"wajah, buka kunci, autentikasi, login"</string>
|
||||
|
@@ -3157,7 +3157,7 @@
|
||||
<string name="keywords_sim_status" msgid="6682044233620329507">"网络, 移动网络状态, 服务状态, 信号强度, 移动网络类型, 漫游, iccid, eid"</string>
|
||||
<string name="keywords_model_and_hardware" msgid="1459248377212829642">"序列号, 硬件版本"</string>
|
||||
<string name="keywords_android_version" msgid="9069747153590902819">"Android 安全补丁程序级别, 基带版本, 内核版本"</string>
|
||||
<string name="keywords_dark_ui_mode" msgid="8999745898782012625">"主题背景, 浅色, 夜间, 模式"</string>
|
||||
<string name="keywords_dark_ui_mode" msgid="8999745898782012625">"主题背景, 光亮, 暗黑, 模式"</string>
|
||||
<string name="keywords_systemui_theme" msgid="9112852512550404882">"深色主题背景"</string>
|
||||
<string name="keywords_device_feedback" msgid="564493721125966719">"错误"</string>
|
||||
<string name="keywords_ambient_display_screen" msgid="5874969496073249362">"主动显示, 锁定屏幕显示"</string>
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
@@ -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) && (
|
||||
|
@@ -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 "";
|
||||
}
|
||||
}
|
||||
|
@@ -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");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user