Snap for 9930594 from d1267c1675 to udc-release
Change-Id: Ibd777d7b5a60d3314ecbfccf49ace6da94d01a58
This commit is contained in:
@@ -1358,7 +1358,7 @@
|
||||
<activity
|
||||
android:name="Settings$SmartAutoRotateSettingsActivity"
|
||||
android:label="@string/accelerometer_title"
|
||||
android:icon="@drawable/ic_screen_rotation_24dp"
|
||||
android:icon="@drawable/ic_screen_rotation"
|
||||
android:exported="true">
|
||||
<intent-filter android:priority="1">
|
||||
<action android:name="android.settings.AUTO_ROTATE_SETTINGS" />
|
||||
|
||||
6
OWNERS
6
OWNERS
@@ -2,22 +2,18 @@
|
||||
android-settings-core-eng+gerrit@google.com
|
||||
|
||||
# People who can approve changes for submission
|
||||
arcwang@google.com
|
||||
cantol@google.com
|
||||
chaohuiw@google.com
|
||||
chiujason@google.com
|
||||
cyl@google.com
|
||||
dswliu@google.com
|
||||
edgarwang@google.com
|
||||
llz@google.com
|
||||
millchen@google.com
|
||||
songchenxi@google.com
|
||||
stanleytfwang@google.com
|
||||
sunnyshao@google.com
|
||||
yantingyang@google.com
|
||||
ykhung@google.com
|
||||
|
||||
# Emergency only
|
||||
lijun@google.com
|
||||
wangqi@google.com
|
||||
yanglu@google.com
|
||||
|
||||
|
||||
@@ -4429,6 +4429,22 @@
|
||||
column="13"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="HardCodedColor"
|
||||
severity="Error"
|
||||
message="Avoid using hardcoded color"
|
||||
category="Correctness"
|
||||
priority="4"
|
||||
summary="Using hardcoded color"
|
||||
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
|
||||
errorLine1=" android:color="@color/homepage_display_background" />"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="res/drawable/ic_screen_rotation.xml"
|
||||
line="24"
|
||||
column="13"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="HardCodedColor"
|
||||
severity="Error"
|
||||
|
||||
@@ -96,6 +96,12 @@
|
||||
<!-- Introduction detail message shown in face enrollment dialog when asking for parental consent [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_face_enroll_introduction_consent_message_0" product="device">Allow your child to use their face to unlock their device</string>
|
||||
<!-- Introduction detail message shown in face enrollment dialog when asking for parental consent [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_face_enroll_introduction_consent_message_0_class3" product="default">Allow your child to use their face to unlock their phone or verify it\u2019s them. This happens when they sign in to apps, approve a purchase, and more.</string>
|
||||
<!-- Introduction detail message shown in face enrollment dialog when asking for parental consent [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_face_enroll_introduction_consent_message_0_class3" product="tablet">Allow your child to use their face to unlock their tablet or verify it\u2019s them. This happens when they sign in to apps, approve a purchase, and more.</string>
|
||||
<!-- Introduction detail message shown in face enrollment dialog when asking for parental consent [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_face_enroll_introduction_consent_message_0_class3" product="device">Allow your child to use their face to unlock their device or verify it\u2019s them. This happens when they sign in to apps, approve a purchase, and more.</string>
|
||||
<!-- Introduction detail message shown in face enrollment dialog when asking for parental consent [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_face_enroll_introduction_consent_message" product="default">Using your child\u2019s face to unlock their phone may be less secure than a strong pattern or PIN.</string>
|
||||
<!-- Introduction detail message shown in face enrollment dialog when asking for parental consent [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_face_enroll_introduction_consent_message" product="tablet">Using your child\u2019s face to unlock their tablet may be less secure than a strong pattern or PIN.</string>
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?androidprv:attr/materialColorPrimaryContainer">
|
||||
android:tint="?androidprv:attr/colorAccent">
|
||||
<path
|
||||
android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z"
|
||||
android:fillColor="@android:color/white"/>
|
||||
</vector>
|
||||
</vector>
|
||||
|
||||
33
res/drawable/ic_screen_rotation.xml
Normal file
33
res/drawable/ic_screen_rotation.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2023 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.
|
||||
-->
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item>
|
||||
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
|
||||
android:width="@dimen/dashboard_tile_image_size"
|
||||
android:height="@dimen/dashboard_tile_image_size"
|
||||
android:color="@color/homepage_display_background" />
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:width="@dimen/dashboard_tile_foreground_image_size"
|
||||
android:height="@dimen/dashboard_tile_foreground_image_size"
|
||||
android:start="@dimen/dashboard_tile_foreground_image_inset"
|
||||
android:top="@dimen/dashboard_tile_foreground_image_inset"
|
||||
android:drawable="@drawable/ic_screen_rotation_24dp" />
|
||||
</layer-list>
|
||||
@@ -11904,6 +11904,12 @@
|
||||
<!-- Developer settings: Summary for disabling phantom process monitoring. [CHAR LIMIT=NONE]-->
|
||||
<string name="disable_phantom_process_monitor_summary">Disable restrictions on the system resource usage of the app child processes</string>
|
||||
|
||||
<!-- Developer settings: Title for force enabling Notes role. [CHAR LIMIT=50]-->
|
||||
<string name="enable_notes_role_title">Force enable Notes role</string>
|
||||
<!-- Developer settings: Summary for disabling phantom process monitoring. [CHAR LIMIT=NONE]-->
|
||||
<string name="enable_notes_role_summary">Enable note-taking system integrations via the Notes role. If the Notes role is already enabled, does nothing.</string>
|
||||
|
||||
|
||||
<!-- BT LE Audio Device: Media Broadcast -->
|
||||
<!-- The title of the Media Broadcast Dialog [CHAR LIMIT=none] -->
|
||||
<string name="bluetooth_broadcast_dialog_title">Broadcast</string>
|
||||
|
||||
@@ -713,6 +713,11 @@
|
||||
android:title="@string/disable_phantom_process_monitor_title"
|
||||
android:summary="@string/disable_phantom_process_monitor_summary" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="force_enable_notes_role"
|
||||
android:title="@string/enable_notes_role_title"
|
||||
android:summary="@string/enable_notes_role_summary" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
|
||||
@@ -134,6 +134,8 @@ public final class Utils extends com.android.settingslib.Utils {
|
||||
|
||||
public static final String SETTINGS_PACKAGE_NAME = "com.android.settings";
|
||||
|
||||
public static final String SYSTEMUI_PACKAGE_NAME = "com.android.systemui";
|
||||
|
||||
public static final String OS_PKG = "os";
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,6 +19,7 @@ import android.Manifest;
|
||||
import android.app.AppOpsManager;
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settingslib.applications.ApplicationsState;
|
||||
import com.android.settingslib.applications.ApplicationsState.AppEntry;
|
||||
import com.android.settingslib.applications.ApplicationsState.AppFilter;
|
||||
@@ -59,7 +60,7 @@ public class AppStateOverlayBridge extends AppStateAppOpsBridge {
|
||||
private static final List<String> DISABLE_PACKAGE_LIST = new ArrayList<>();
|
||||
|
||||
static {
|
||||
DISABLE_PACKAGE_LIST.add("com.android.systemui");
|
||||
DISABLE_PACKAGE_LIST.add(Utils.SYSTEMUI_PACKAGE_NAME);
|
||||
}
|
||||
|
||||
public OverlayState(PermissionState permissionState) {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.settings.applications;
|
||||
|
||||
import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
|
||||
import static com.android.settings.Utils.SYSTEMUI_PACKAGE_NAME;
|
||||
|
||||
import android.app.Application;
|
||||
import android.app.usage.UsageStats;
|
||||
@@ -76,7 +77,7 @@ public class RecentAppStatsMixin implements LifecycleObserver, OnStart {
|
||||
"android",
|
||||
"com.android.phone",
|
||||
SETTINGS_PACKAGE_NAME,
|
||||
"com.android.systemui",
|
||||
SYSTEMUI_PACKAGE_NAME,
|
||||
"com.android.providers.calendar",
|
||||
"com.android.providers.media"
|
||||
));
|
||||
|
||||
@@ -38,6 +38,7 @@ import androidx.preference.Preference.OnPreferenceClickListener;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.applications.AppInfoBase;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settings.widget.EmptyTextSettings;
|
||||
@@ -57,7 +58,7 @@ public class PictureInPictureSettings extends EmptyTextSettings {
|
||||
static final List<String> IGNORE_PACKAGE_LIST = new ArrayList<>();
|
||||
|
||||
static {
|
||||
IGNORE_PACKAGE_LIST.add("com.android.systemui");
|
||||
IGNORE_PACKAGE_LIST.add(Utils.SYSTEMUI_PACKAGE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,6 +37,7 @@ import androidx.preference.Preference.OnPreferenceClickListener;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.applications.AppInfoBase;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settings.widget.EmptyTextSettings;
|
||||
@@ -58,7 +59,7 @@ public class TurnScreenOnSettings extends EmptyTextSettings {
|
||||
static final List<String> IGNORE_PACKAGE_LIST = new ArrayList<>();
|
||||
|
||||
static {
|
||||
IGNORE_PACKAGE_LIST.add("com.android.systemui");
|
||||
IGNORE_PACKAGE_LIST.add(Utils.SYSTEMUI_PACKAGE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -592,6 +592,10 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
|
||||
return data;
|
||||
}
|
||||
|
||||
protected boolean isFaceStrong() {
|
||||
return mIsFaceStrong;
|
||||
}
|
||||
|
||||
private void onFaceStrengthChanged() {
|
||||
// Set up and show the "less secure" info section if necessary.
|
||||
if (!mIsFaceStrong && getResources().getBoolean(
|
||||
|
||||
@@ -47,13 +47,14 @@ public class FaceEnrollParentalConsent extends FaceEnrollIntroduction {
|
||||
R.string.security_settings_face_enroll_introduction_control_consent_title,
|
||||
R.string.security_settings_face_enroll_introduction_control_consent_message,
|
||||
R.string.security_settings_face_enroll_introduction_consent_message_0,
|
||||
R.string.security_settings_face_enroll_introduction_consent_message_0_class3,
|
||||
R.string.security_settings_face_enroll_introduction_info_consent_less_secure
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setDescriptionText(R.string.security_settings_face_enroll_introduction_consent_message_0);
|
||||
updateDescriptionText();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -144,4 +145,16 @@ public class FaceEnrollParentalConsent extends FaceEnrollIntroduction {
|
||||
public int getMetricsCategory() {
|
||||
return SettingsEnums.FACE_PARENTAL_CONSENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateDescriptionText() {
|
||||
super.updateDescriptionText();
|
||||
if (isFaceStrong()) {
|
||||
setDescriptionText(getString(
|
||||
R.string.security_settings_face_enroll_introduction_consent_message_0_class3));
|
||||
} else {
|
||||
setDescriptionText(
|
||||
R.string.security_settings_face_enroll_introduction_consent_message_0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,4 +131,12 @@ public class FingerprintEnrollParentalConsent extends FingerprintEnrollIntroduct
|
||||
public int getMetricsCategory() {
|
||||
return SettingsEnums.FINGERPRINT_PARENTAL_CONSENT;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void updateDescriptionText() {
|
||||
super.updateDescriptionText();
|
||||
setDescriptionText(
|
||||
R.string.security_settings_fingerprint_enroll_introduction_consent_message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,14 +18,11 @@ package com.android.settings.biometrics2.ui.view;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.biometrics2.ui.viewmodel.FingerprintEnrollEnrollingViewModel;
|
||||
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||
|
||||
/**
|
||||
@@ -33,15 +30,6 @@ import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||
*/
|
||||
public class FingerprintEnrollEnrollingIconTouchDialog extends InstrumentedDialogFragment {
|
||||
|
||||
private FingerprintEnrollEnrollingViewModel mViewModel;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
mViewModel = new ViewModelProvider(getActivity()).get(
|
||||
FingerprintEnrollEnrollingViewModel.class);
|
||||
super.onAttach(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(),
|
||||
@@ -50,10 +38,7 @@ public class FingerprintEnrollEnrollingIconTouchDialog extends InstrumentedDialo
|
||||
.setMessage(R.string.security_settings_fingerprint_enroll_touch_dialog_message)
|
||||
.setPositiveButton(
|
||||
R.string.security_settings_fingerprint_enroll_dialog_ok,
|
||||
(dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
mViewModel.onIconTouchDialogDismiss();
|
||||
});
|
||||
(dialog, which) -> dialog.dismiss());
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ import static com.android.settings.biometrics2.ui.viewmodel.AutoCredentialViewMo
|
||||
import static com.android.settings.biometrics2.ui.viewmodel.AutoCredentialViewModel.CREDENTIAL_IS_GENERATING_CHALLENGE;
|
||||
import static com.android.settings.biometrics2.ui.viewmodel.AutoCredentialViewModel.CREDENTIAL_VALID;
|
||||
import static com.android.settings.biometrics2.ui.viewmodel.FingerprintEnrollEnrollingViewModel.ErrorDialogData;
|
||||
import static com.android.settings.biometrics2.ui.viewmodel.FingerprintEnrollEnrollingViewModel.FINGERPRINT_ENROLL_ENROLLING_ACTION_DISMISS_ICON_TOUCH_DIALOG;
|
||||
import static com.android.settings.biometrics2.ui.viewmodel.FingerprintEnrollEnrollingViewModel.FINGERPRINT_ENROLL_ENROLLING_ACTION_DONE;
|
||||
import static com.android.settings.biometrics2.ui.viewmodel.FingerprintEnrollEnrollingViewModel.FINGERPRINT_ENROLL_ENROLLING_ACTION_SHOW_ICON_TOUCH_DIALOG;
|
||||
import static com.android.settings.biometrics2.ui.viewmodel.FingerprintEnrollEnrollingViewModel.FINGERPRINT_ENROLL_ENROLLING_CANCELED_BECAUSE_BACK_PRESSED;
|
||||
@@ -518,10 +517,6 @@ public class FingerprintEnrollmentActivity extends FragmentActivity {
|
||||
SKIP_SETUP_FIND_FPS_DIALOG_TAG);
|
||||
break;
|
||||
}
|
||||
case FINGERPRINT_ENROLL_ENROLLING_ACTION_DISMISS_ICON_TOUCH_DIALOG: {
|
||||
onSetActivityResult(new ActivityResult(BiometricEnrollBase.RESULT_TIMEOUT, null));
|
||||
break;
|
||||
}
|
||||
case FINGERPRINT_ENROLL_ENROLLING_CANCELED_BECAUSE_BACK_PRESSED: {
|
||||
if (getSupportFragmentManager().getBackStackEntryCount() > 0) {
|
||||
getSupportFragmentManager().popBackStack();
|
||||
|
||||
@@ -60,25 +60,19 @@ public class FingerprintEnrollEnrollingViewModel extends AndroidViewModel {
|
||||
*/
|
||||
public static final int FINGERPRINT_ENROLL_ENROLLING_ACTION_SHOW_ICON_TOUCH_DIALOG = 1;
|
||||
|
||||
/**
|
||||
* Icon touch dialog dismiss
|
||||
*/
|
||||
public static final int FINGERPRINT_ENROLL_ENROLLING_ACTION_DISMISS_ICON_TOUCH_DIALOG = 2;
|
||||
|
||||
/**
|
||||
* Has got latest cancelled event due to user skip
|
||||
*/
|
||||
public static final int FINGERPRINT_ENROLL_ENROLLING_CANCELED_BECAUSE_USER_SKIP = 3;
|
||||
public static final int FINGERPRINT_ENROLL_ENROLLING_CANCELED_BECAUSE_USER_SKIP = 2;
|
||||
|
||||
/**
|
||||
* Has got latest cancelled event due to back key
|
||||
*/
|
||||
public static final int FINGERPRINT_ENROLL_ENROLLING_CANCELED_BECAUSE_BACK_PRESSED = 4;
|
||||
public static final int FINGERPRINT_ENROLL_ENROLLING_CANCELED_BECAUSE_BACK_PRESSED = 3;
|
||||
|
||||
@IntDef(prefix = { "FINGERPRINT_ENROLL_ENROLLING_ACTION_" }, value = {
|
||||
FINGERPRINT_ENROLL_ENROLLING_ACTION_DONE,
|
||||
FINGERPRINT_ENROLL_ENROLLING_ACTION_SHOW_ICON_TOUCH_DIALOG,
|
||||
FINGERPRINT_ENROLL_ENROLLING_ACTION_DISMISS_ICON_TOUCH_DIALOG,
|
||||
FINGERPRINT_ENROLL_ENROLLING_CANCELED_BECAUSE_USER_SKIP,
|
||||
FINGERPRINT_ENROLL_ENROLLING_CANCELED_BECAUSE_BACK_PRESSED
|
||||
})
|
||||
@@ -116,7 +110,6 @@ public class FingerprintEnrollEnrollingViewModel extends AndroidViewModel {
|
||||
private final Vibrator mVibrator;
|
||||
|
||||
private final MutableLiveData<Integer> mActionLiveData = new MutableLiveData<>();
|
||||
private final MutableLiveData<Integer> mIconTouchDialogLiveData = new MutableLiveData<>();
|
||||
private final MutableLiveData<ErrorDialogData> mErrorDialogLiveData = new MutableLiveData<>();
|
||||
private final MutableLiveData<Integer> mErrorDialogActionLiveData = new MutableLiveData<>();
|
||||
|
||||
@@ -233,17 +226,6 @@ public class FingerprintEnrollEnrollingViewModel extends AndroidViewModel {
|
||||
mActionLiveData.postValue(action);
|
||||
}
|
||||
|
||||
/**
|
||||
* Icon touch dialog dismiss
|
||||
*/
|
||||
public void onIconTouchDialogDismiss() {
|
||||
final int action = FINGERPRINT_ENROLL_ENROLLING_ACTION_DISMISS_ICON_TOUCH_DIALOG;
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "onIconTouchDialogDismiss, post action " + action);
|
||||
}
|
||||
mActionLiveData.postValue(action);
|
||||
}
|
||||
|
||||
/**
|
||||
* get enroll stage threshold
|
||||
*/
|
||||
|
||||
@@ -25,6 +25,7 @@ import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.bluetooth.BluetoothDeviceRenamePreferenceController;
|
||||
import com.android.settings.bluetooth.BluetoothSwitchPreferenceController;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
@@ -45,8 +46,6 @@ public class BluetoothDashboardFragment extends DashboardFragment {
|
||||
|
||||
private static final String TAG = "BluetoothDashboardFrag";
|
||||
private static final String KEY_BLUETOOTH_SCREEN_FOOTER = "bluetooth_screen_footer";
|
||||
private static final String SETTINGS_PACKAGE_NAME = "com.android.settings";
|
||||
private static final String SYSTEMUI_PACKAGE_NAME = "com.android.systemui";
|
||||
private static final String SLICE_ACTION = "com.android.settings.SEARCH_RESULT_TRAMPOLINE";
|
||||
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
||||
|
||||
@@ -112,8 +111,8 @@ public class BluetoothDashboardFragment extends DashboardFragment {
|
||||
@VisibleForTesting
|
||||
boolean isAlwaysDiscoverable(String callingAppPackageName, String action) {
|
||||
return TextUtils.equals(SLICE_ACTION, action) ? false
|
||||
: TextUtils.equals(SETTINGS_PACKAGE_NAME, callingAppPackageName)
|
||||
|| TextUtils.equals(SYSTEMUI_PACKAGE_NAME, callingAppPackageName);
|
||||
: TextUtils.equals(Utils.SETTINGS_PACKAGE_NAME, callingAppPackageName)
|
||||
|| TextUtils.equals(Utils.SYSTEMUI_PACKAGE_NAME, callingAppPackageName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,6 +28,7 @@ import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.core.SettingsUIDeviceConfig;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
@@ -38,7 +39,6 @@ import com.android.settingslib.search.SearchIndexable;
|
||||
public class ConnectedDeviceDashboardFragment extends DashboardFragment {
|
||||
|
||||
private static final String TAG = "ConnectedDeviceFrag";
|
||||
private static final String SYSTEMUI_PACKAGE_NAME = "com.android.systemui";
|
||||
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
||||
private static final String SLICE_ACTION = "com.android.settings.SEARCH_RESULT_TRAMPOLINE";
|
||||
|
||||
@@ -92,8 +92,8 @@ public class ConnectedDeviceDashboardFragment extends DashboardFragment {
|
||||
@VisibleForTesting
|
||||
boolean isAlwaysDiscoverable(String callingAppPackageName, String action) {
|
||||
return TextUtils.equals(SLICE_ACTION, action) ? false
|
||||
: TextUtils.equals(SETTINGS_PACKAGE_NAME, callingAppPackageName)
|
||||
|| TextUtils.equals(SYSTEMUI_PACKAGE_NAME, callingAppPackageName);
|
||||
: TextUtils.equals(Utils.SETTINGS_PACKAGE_NAME, callingAppPackageName)
|
||||
|| TextUtils.equals(Utils.SYSTEMUI_PACKAGE_NAME, callingAppPackageName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -733,6 +733,7 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
|
||||
controllers.add(new PhantomProcessPreferenceController(context));
|
||||
controllers.add(new ContrastPreferenceController(
|
||||
context, context.getSystemService(UiModeManager.class)));
|
||||
controllers.add(new ForceEnableNotesRolePreferenceController(context));
|
||||
|
||||
return controllers;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (C) 2023 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.
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2023 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.development;
|
||||
|
||||
import static android.os.UserHandle.USER_CURRENT;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.om.IOverlayManager;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import com.android.internal.R;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
|
||||
public class ForceEnableNotesRolePreferenceController
|
||||
extends DeveloperOptionsPreferenceController
|
||||
implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
|
||||
|
||||
private static final String NOTES_ROLE_ENABLED_KEY =
|
||||
"force_enable_notes_role";
|
||||
|
||||
private static final String OVERLAY_PACKAGE_NAME =
|
||||
"com.android.role.notes.enabled";
|
||||
|
||||
private final IOverlayManager mOverlayManager;
|
||||
|
||||
public ForceEnableNotesRolePreferenceController(Context context) {
|
||||
super(context);
|
||||
mOverlayManager = IOverlayManager.Stub.asInterface(
|
||||
ServiceManager.getService(Context.OVERLAY_SERVICE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPreferenceKey() {
|
||||
return NOTES_ROLE_ENABLED_KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
setEnabled((boolean) newValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
((SwitchPreference) mPreference).setChecked(isEnabled());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
setEnabled(false);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
protected boolean isEnabled() {
|
||||
return mContext.getResources().getBoolean(R.bool.config_enableDefaultNotes);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
protected void setEnabled(boolean enabled) {
|
||||
try {
|
||||
mOverlayManager.setEnabled(OVERLAY_PACKAGE_NAME, enabled, USER_CURRENT);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.fuelgauge;
|
||||
|
||||
import static com.android.settings.Utils.SYSTEMUI_PACKAGE_NAME;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -35,9 +37,8 @@ public class PowerUsageFeatureProviderImpl implements PowerUsageFeatureProvider
|
||||
|
||||
private static final String PACKAGE_CALENDAR_PROVIDER = "com.android.providers.calendar";
|
||||
private static final String PACKAGE_MEDIA_PROVIDER = "com.android.providers.media";
|
||||
private static final String PACKAGE_SYSTEMUI = "com.android.systemui";
|
||||
private static final String[] PACKAGES_SYSTEM = {PACKAGE_MEDIA_PROVIDER,
|
||||
PACKAGE_CALENDAR_PROVIDER, PACKAGE_SYSTEMUI};
|
||||
PACKAGE_CALENDAR_PROVIDER, SYSTEMUI_PACKAGE_NAME};
|
||||
|
||||
protected PackageManager mPackageManager;
|
||||
protected Context mContext;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.android.settings.fuelgauge.batteryusage;
|
||||
|
||||
import static com.android.settings.Utils.formatPercentage;
|
||||
import static com.android.settings.fuelgauge.batteryusage.BatteryChartViewModel.AxisLabelPosition.BETWEEN_TRAPEZOIDS;
|
||||
|
||||
import static java.lang.Math.round;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
@@ -29,6 +30,7 @@ import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.util.ArraySet;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
@@ -52,13 +54,13 @@ import com.android.settingslib.Utils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
/** A widget component to draw chart graph. */
|
||||
public class BatteryChartView extends AppCompatImageView implements View.OnClickListener {
|
||||
private static final String TAG = "BatteryChartView";
|
||||
|
||||
private static final int DIVIDER_COLOR = Color.parseColor("#CDCCC5");
|
||||
private static final long UPDATE_STATE_DELAYED_TIME = 500L;
|
||||
|
||||
/** A callback listener for selected group index is updated. */
|
||||
public interface OnSelectListener {
|
||||
@@ -70,6 +72,7 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
|
||||
private final Rect mIndent = new Rect();
|
||||
private final Rect[] mPercentageBounds = new Rect[]{new Rect(), new Rect(), new Rect()};
|
||||
private final List<Rect> mAxisLabelsBounds = new ArrayList<>();
|
||||
private final Set<Integer> mLabelDrawnIndexes = new ArraySet<>();
|
||||
|
||||
private BatteryChartViewModel mViewModel;
|
||||
private int mHoveredIndex = BatteryChartViewModel.SELECTED_INDEX_INVALID;
|
||||
@@ -80,6 +83,7 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
|
||||
private int mTrapezoidColor;
|
||||
private int mTrapezoidSolidColor;
|
||||
private int mTrapezoidHoverColor;
|
||||
private int mDefaultTextColor;
|
||||
private int mTextPadding;
|
||||
private Paint mDividerPaint;
|
||||
private Paint mTrapezoidPaint;
|
||||
@@ -134,6 +138,7 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
|
||||
// Pre-draws the view first to load style atttributions into paint.
|
||||
textView.draw(new Canvas());
|
||||
mTextPaint = textView.getPaint();
|
||||
mDefaultTextColor = mTextPaint.getColor();
|
||||
} else {
|
||||
mTextPaint = null;
|
||||
}
|
||||
@@ -332,6 +337,7 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
|
||||
final int height = getHeight() - mIndent.top - mIndent.bottom;
|
||||
// Draws the top divider line for 100% curve.
|
||||
float offsetY = mIndent.top + mDividerWidth * .5f;
|
||||
mDividerPaint.setColor(DIVIDER_COLOR);
|
||||
canvas.drawLine(0, offsetY, width, offsetY, mDividerPaint);
|
||||
drawPercentage(canvas, /*index=*/ 0, offsetY);
|
||||
|
||||
@@ -351,6 +357,7 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
|
||||
private void drawPercentage(Canvas canvas, int index, float offsetY) {
|
||||
if (mTextPaint != null) {
|
||||
mTextPaint.setTextAlign(Paint.Align.RIGHT);
|
||||
mTextPaint.setColor(mDefaultTextColor);
|
||||
canvas.drawText(
|
||||
mPercentages[index],
|
||||
getWidth(),
|
||||
@@ -367,18 +374,6 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
|
||||
final float bottomY = getHeight() - mIndent.bottom;
|
||||
final float startY = bottomY - mDividerHeight;
|
||||
final float trapezoidSlotOffset = mTrapezoidHOffset + mDividerWidth * .5f;
|
||||
// Draws each vertical dividers.
|
||||
float startX = mDividerWidth * .5f;
|
||||
for (int index = 0; index < dividerCount; index++) {
|
||||
canvas.drawLine(startX, startY, startX, bottomY, mDividerPaint);
|
||||
final float nextX = startX + mDividerWidth + unitWidth;
|
||||
// Updates the trapezoid slots for drawing.
|
||||
if (index < mTrapezoidSlots.length) {
|
||||
mTrapezoidSlots[index].mLeft = round(startX + trapezoidSlotOffset);
|
||||
mTrapezoidSlots[index].mRight = round(nextX - trapezoidSlotOffset);
|
||||
}
|
||||
startX = nextX;
|
||||
}
|
||||
// Draws the axis label slot information.
|
||||
if (mViewModel != null) {
|
||||
final float baselineY = getHeight() - mTextPadding;
|
||||
@@ -404,6 +399,26 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
|
||||
}
|
||||
drawAxisLabels(canvas, axisLabelDisplayAreas, baselineY);
|
||||
}
|
||||
// Draws each vertical dividers.
|
||||
float startX = mDividerWidth * .5f;
|
||||
for (int index = 0; index < dividerCount; index++) {
|
||||
float dividerY = bottomY;
|
||||
if (mViewModel.axisLabelPosition() == BETWEEN_TRAPEZOIDS
|
||||
&& mLabelDrawnIndexes.contains(index)) {
|
||||
mDividerPaint.setColor(mTrapezoidSolidColor);
|
||||
dividerY += mDividerHeight / 4f;
|
||||
} else {
|
||||
mDividerPaint.setColor(DIVIDER_COLOR);
|
||||
}
|
||||
canvas.drawLine(startX, startY, startX, dividerY, mDividerPaint);
|
||||
final float nextX = startX + mDividerWidth + unitWidth;
|
||||
// Updates the trapezoid slots for drawing.
|
||||
if (index < mTrapezoidSlots.length) {
|
||||
mTrapezoidSlots[index].mLeft = round(startX + trapezoidSlotOffset);
|
||||
mTrapezoidSlots[index].mRight = round(nextX - trapezoidSlotOffset);
|
||||
}
|
||||
startX = nextX;
|
||||
}
|
||||
}
|
||||
|
||||
/** Gets all the axis label texts displaying area positions if they are shown. */
|
||||
@@ -432,9 +447,12 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
|
||||
|
||||
private void drawAxisLabels(Canvas canvas, final Rect[] displayAreas, final float baselineY) {
|
||||
final int lastIndex = displayAreas.length - 1;
|
||||
mLabelDrawnIndexes.clear();
|
||||
// Suppose first and last labels are always able to draw.
|
||||
drawAxisLabelText(canvas, 0, displayAreas[0], baselineY);
|
||||
mLabelDrawnIndexes.add(0);
|
||||
drawAxisLabelText(canvas, lastIndex, displayAreas[lastIndex], baselineY);
|
||||
mLabelDrawnIndexes.add(lastIndex);
|
||||
drawAxisLabelsBetweenStartIndexAndEndIndex(canvas, displayAreas, 0, lastIndex, baselineY);
|
||||
}
|
||||
|
||||
@@ -458,6 +476,7 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
|
||||
return;
|
||||
}
|
||||
drawAxisLabelText(canvas, middleIndex, displayAreas[middleIndex], baselineY);
|
||||
mLabelDrawnIndexes.add(middleIndex);
|
||||
drawAxisLabelsBetweenStartIndexAndEndIndex(
|
||||
canvas, displayAreas, startIndex, middleIndex, baselineY);
|
||||
drawAxisLabelsBetweenStartIndexAndEndIndex(
|
||||
@@ -471,7 +490,9 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
|
||||
return;
|
||||
}
|
||||
drawAxisLabelText(canvas, middleIndex1, displayAreas[middleIndex1], baselineY);
|
||||
mLabelDrawnIndexes.add(middleIndex1);
|
||||
drawAxisLabelText(canvas, middleIndex2, displayAreas[middleIndex2], baselineY);
|
||||
mLabelDrawnIndexes.add(middleIndex2);
|
||||
drawAxisLabelsBetweenStartIndexAndEndIndex(
|
||||
canvas, displayAreas, startIndex, middleIndex1, baselineY);
|
||||
drawAxisLabelsBetweenStartIndexAndEndIndex(
|
||||
@@ -488,12 +509,14 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
|
||||
|
||||
private void drawAxisLabelText(
|
||||
Canvas canvas, final int index, final Rect displayArea, final float baselineY) {
|
||||
mTextPaint.setColor(mTrapezoidSolidColor);
|
||||
mTextPaint.setTextAlign(Paint.Align.CENTER);
|
||||
canvas.drawText(
|
||||
mViewModel.getText(index),
|
||||
displayArea.centerX(),
|
||||
baselineY,
|
||||
mTextPaint);
|
||||
mLabelDrawnIndexes.add(index);
|
||||
}
|
||||
|
||||
private void drawTrapezoids(Canvas canvas) {
|
||||
|
||||
@@ -313,11 +313,8 @@ public class BatteryUsageBreakdownController extends BasePreferenceController
|
||||
@VisibleForTesting
|
||||
void removeAndCacheAllUnusedPreferences() {
|
||||
List<BatteryDiffEntry> entries = getBatteryDiffEntries();
|
||||
Set<String> entryKeySet = new ArraySet<>();
|
||||
for (BatteryDiffEntry entry : entries) {
|
||||
entryKeySet.add(entry.getKey());
|
||||
}
|
||||
|
||||
Set<String> entryKeySet = new ArraySet<>(entries.size());
|
||||
entries.forEach(entry -> entryKeySet.add(entry.getKey()));
|
||||
final int prefsCount = mAppListPreferenceGroup.getPreferenceCount();
|
||||
for (int index = prefsCount - 1; index >= 0; index--) {
|
||||
final Preference pref = mAppListPreferenceGroup.getPreference(index);
|
||||
|
||||
@@ -725,9 +725,9 @@ public final class DataProcessor {
|
||||
@VisibleForTesting
|
||||
@Nullable
|
||||
static Map<Long, Map<String, List<AppUsagePeriod>>> buildAppUsagePeriodList(
|
||||
final List<AppUsageEvent> allAppUsageEvents, final List<BatteryEvent> batteryEventList,
|
||||
final List<AppUsageEvent> appUsageEvents, final List<BatteryEvent> batteryEventList,
|
||||
final long startTime, final long endTime) {
|
||||
if (allAppUsageEvents.isEmpty()) {
|
||||
if (appUsageEvents.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -735,7 +735,7 @@ public final class DataProcessor {
|
||||
// use.
|
||||
final List<AppUsageEvent> deviceEvents = new ArrayList<>();
|
||||
final ArrayMap<Integer, List<AppUsageEvent>> usageEventsByInstanceId = new ArrayMap<>();
|
||||
for (final AppUsageEvent event : allAppUsageEvents) {
|
||||
for (final AppUsageEvent event : appUsageEvents) {
|
||||
final AppUsageEventType eventType = event.getType();
|
||||
if (eventType == AppUsageEventType.ACTIVITY_RESUMED
|
||||
|| eventType == AppUsageEventType.ACTIVITY_STOPPED) {
|
||||
@@ -852,9 +852,11 @@ public final class DataProcessor {
|
||||
final List<AppUsagePeriod> usagePeriodList,
|
||||
final List<BatteryEvent> batteryEventList) {
|
||||
final List<AppUsagePeriod> resultList = new ArrayList<>();
|
||||
int index = 0;
|
||||
for (AppUsagePeriod inputPeriod : usagePeriodList) {
|
||||
long lastStartTime = inputPeriod.getStartTime();
|
||||
for (BatteryEvent batteryEvent : batteryEventList) {
|
||||
while (index < batteryEventList.size()) {
|
||||
BatteryEvent batteryEvent = batteryEventList.get(index);
|
||||
if (batteryEvent.getTimestamp() < inputPeriod.getStartTime()) {
|
||||
// Because the batteryEventList has been sorted, here is to mark the power
|
||||
// connection state when the usage period starts. If power is connected when
|
||||
@@ -865,6 +867,7 @@ public final class DataProcessor {
|
||||
} else if (batteryEvent.getType() == BatteryEventType.POWER_DISCONNECTED) {
|
||||
lastStartTime = inputPeriod.getStartTime();
|
||||
}
|
||||
index++;
|
||||
continue;
|
||||
}
|
||||
if (batteryEvent.getTimestamp() > inputPeriod.getEndTime()) {
|
||||
@@ -883,6 +886,7 @@ public final class DataProcessor {
|
||||
} else if (batteryEvent.getType() == BatteryEventType.POWER_DISCONNECTED) {
|
||||
lastStartTime = batteryEvent.getTimestamp();
|
||||
}
|
||||
index++;
|
||||
}
|
||||
if (lastStartTime != 0) {
|
||||
resultList.add(AppUsagePeriod.newBuilder()
|
||||
|
||||
@@ -110,13 +110,7 @@ public final class DatabaseUtils {
|
||||
|
||||
// For testing only.
|
||||
@VisibleForTesting
|
||||
static Supplier<Cursor> sFakeBatteryStateSupplier;
|
||||
@VisibleForTesting
|
||||
static Supplier<Cursor> sFakeAppUsageEventSupplier;
|
||||
@VisibleForTesting
|
||||
static Supplier<Cursor> sFakeAppUsageLatestTimestampSupplier;
|
||||
@VisibleForTesting
|
||||
static Supplier<Cursor> sFakeBatteryEventSupplier;
|
||||
static Supplier<Cursor> sFakeSupplier;
|
||||
|
||||
private DatabaseUtils() {
|
||||
}
|
||||
@@ -340,7 +334,7 @@ public final class DatabaseUtils {
|
||||
resolver.insert(BATTERY_EVENT_URI, contentValues);
|
||||
Log.d(TAG, "insert() battery event data into database: " + batteryEvent.toString());
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "insert() battery event data into database error:\n" + e);
|
||||
Log.e(TAG, "insert() battery event data into database error:", e);
|
||||
}
|
||||
Log.d(TAG, String.format("sendBatteryEventData() in %d/ms",
|
||||
(System.currentTimeMillis() - startTime)));
|
||||
@@ -487,8 +481,8 @@ public final class DatabaseUtils {
|
||||
Context context, final Uri appUsageLatestTimestampUri) {
|
||||
// We have already make sure the context here is with profile parent's user identity. Don't
|
||||
// need to check whether current user is work profile.
|
||||
try (Cursor cursor = sFakeAppUsageLatestTimestampSupplier != null
|
||||
? sFakeAppUsageLatestTimestampSupplier.get()
|
||||
try (Cursor cursor = sFakeSupplier != null
|
||||
? sFakeSupplier.get()
|
||||
: context.getContentResolver().query(
|
||||
appUsageLatestTimestampUri, null, null, null)) {
|
||||
if (cursor == null || cursor.getCount() == 0) {
|
||||
@@ -514,8 +508,8 @@ public final class DatabaseUtils {
|
||||
if (context == null) {
|
||||
return appUsageEventList;
|
||||
}
|
||||
try (Cursor cursor = sFakeAppUsageEventSupplier != null
|
||||
? sFakeAppUsageEventSupplier.get()
|
||||
try (Cursor cursor = sFakeSupplier != null
|
||||
? sFakeSupplier.get()
|
||||
: context.getContentResolver().query(appUsageEventUri, null, null, null)) {
|
||||
if (cursor == null || cursor.getCount() == 0) {
|
||||
return appUsageEventList;
|
||||
@@ -540,8 +534,8 @@ public final class DatabaseUtils {
|
||||
if (context == null) {
|
||||
return batteryEventList;
|
||||
}
|
||||
try (Cursor cursor = sFakeBatteryEventSupplier != null
|
||||
? sFakeBatteryEventSupplier.get()
|
||||
try (Cursor cursor = sFakeSupplier != null
|
||||
? sFakeSupplier.get()
|
||||
: context.getContentResolver().query(batteryEventUri, null, null, null)) {
|
||||
if (cursor == null || cursor.getCount() == 0) {
|
||||
return batteryEventList;
|
||||
@@ -566,7 +560,7 @@ public final class DatabaseUtils {
|
||||
return null;
|
||||
}
|
||||
final Map<Long, Map<String, BatteryHistEntry>> resultMap = new HashMap();
|
||||
try (Cursor cursor = sFakeBatteryStateSupplier != null ? sFakeBatteryStateSupplier.get() :
|
||||
try (Cursor cursor = sFakeSupplier != null ? sFakeSupplier.get() :
|
||||
context.getContentResolver().query(batteryStateUri, null, null, null)) {
|
||||
if (cursor == null || cursor.getCount() == 0) {
|
||||
return resultMap;
|
||||
|
||||
@@ -22,9 +22,9 @@ import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.util.FeatureFlagUtils;
|
||||
|
||||
public class PanelFeatureProviderImpl implements PanelFeatureProvider {
|
||||
import com.android.settings.Utils;
|
||||
|
||||
private static final String SYSTEMUI_PACKAGE_NAME = "com.android.systemui";
|
||||
public class PanelFeatureProviderImpl implements PanelFeatureProvider {
|
||||
|
||||
@Override
|
||||
public PanelContent getPanel(Context context, Bundle bundle) {
|
||||
@@ -42,7 +42,7 @@ public class PanelFeatureProviderImpl implements PanelFeatureProvider {
|
||||
// Redirect to the internet dialog in SystemUI.
|
||||
Intent intent = new Intent(Settings.Panel.ACTION_INTERNET_CONNECTIVITY);
|
||||
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
|
||||
.setPackage(SYSTEMUI_PACKAGE_NAME);
|
||||
.setPackage(Utils.SYSTEMUI_PACKAGE_NAME);
|
||||
context.sendBroadcast(intent);
|
||||
return null;
|
||||
case Settings.Panel.ACTION_NFC:
|
||||
@@ -55,7 +55,7 @@ public class PanelFeatureProviderImpl implements PanelFeatureProvider {
|
||||
// Redirect to the volume panel in SystemUI.
|
||||
Intent volumeIntent = new Intent(Settings.Panel.ACTION_VOLUME);
|
||||
volumeIntent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND).setPackage(
|
||||
SYSTEMUI_PACKAGE_NAME);
|
||||
Utils.SYSTEMUI_PACKAGE_NAME);
|
||||
context.sendBroadcast(volumeIntent);
|
||||
return null;
|
||||
} else {
|
||||
|
||||
@@ -33,8 +33,10 @@ import com.android.settings.applications.AppLocaleUtil
|
||||
import com.android.settings.applications.appinfo.AppLocaleDetails
|
||||
import com.android.settings.localepicker.AppLocalePickerActivity
|
||||
import com.android.settingslib.spa.framework.util.filterItem
|
||||
import com.android.settingslib.spaprivileged.framework.common.asUser
|
||||
import com.android.settingslib.spaprivileged.model.app.AppListModel
|
||||
import com.android.settingslib.spaprivileged.model.app.AppRecord
|
||||
import com.android.settingslib.spaprivileged.model.app.userHandle
|
||||
import com.android.settingslib.spaprivileged.template.app.AppListItem
|
||||
import com.android.settingslib.spaprivileged.template.app.AppListItemModel
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -54,17 +56,18 @@ class AppLanguagesListModel(private val context: Context) : AppListModel<AppLang
|
||||
|
||||
override fun transform(userIdFlow: Flow<Int>, appListFlow: Flow<List<ApplicationInfo>>) =
|
||||
userIdFlow.map { userId ->
|
||||
packageManager.queryIntentActivitiesAsUser(
|
||||
userId to packageManager.queryIntentActivitiesAsUser(
|
||||
AppLocaleUtil.LAUNCHER_ENTRY_INTENT,
|
||||
PackageManager.ResolveInfoFlags.of(PackageManager.GET_META_DATA.toLong()),
|
||||
userId,
|
||||
)
|
||||
}.combine(appListFlow) { resolveInfos, appList ->
|
||||
}.combine(appListFlow) { (userId, resolveInfos), appList ->
|
||||
val userContext = context.asUser(UserHandle.of(userId))
|
||||
appList.map { app ->
|
||||
AppLanguagesRecord(
|
||||
app = app,
|
||||
isAppLocaleSupported = AppLocaleUtil.canDisplayLocaleUi(
|
||||
context, app, resolveInfos
|
||||
userContext, app, resolveInfos
|
||||
),
|
||||
)
|
||||
}
|
||||
@@ -86,9 +89,7 @@ class AppLanguagesListModel(private val context: Context) : AppListModel<AppLang
|
||||
}.collectAsStateWithLifecycle(initialValue = stringResource(R.string.summary_placeholder))
|
||||
|
||||
private fun getSummary(app: ApplicationInfo): String =
|
||||
AppLocaleDetails.getAppDefaultLocale(context, app.packageName)?.let {
|
||||
AppLocaleDetails.getSummary(context, app).toString()
|
||||
} ?: context.getString(R.string.preference_of_system_locale_summary)
|
||||
AppLocaleDetails.getSummary(context, app).toString()
|
||||
|
||||
@Composable
|
||||
override fun AppListItemModel<AppLanguagesRecord>.AppItem() {
|
||||
@@ -96,8 +97,7 @@ class AppLanguagesListModel(private val context: Context) : AppListModel<AppLang
|
||||
val intent = Intent(context, AppLocalePickerActivity::class.java).apply {
|
||||
data = Uri.parse("package:${record.app.packageName}")
|
||||
}
|
||||
val userHandle : UserHandle = UserHandle.getUserHandleForUid(record.app.uid)
|
||||
context.startActivityAsUser(intent, userHandle)
|
||||
context.startActivityAsUser(intent, record.app.userHandle)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ package com.android.settings.support;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.android.settings.R;
|
||||
@@ -37,6 +36,9 @@ import java.util.List;
|
||||
@SearchIndexable
|
||||
public class SupportDashboardActivity extends Activity implements Indexable {
|
||||
|
||||
public static final String ACTION_SUPPORT_SETTINGS =
|
||||
"com.android.settings.action.SUPPORT_SETTINGS";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -70,7 +72,7 @@ public class SupportDashboardActivity extends Activity implements Indexable {
|
||||
data.summaryOn = context.getString(R.string.support_summary);
|
||||
data.intentTargetPackage = context.getPackageName();
|
||||
data.intentTargetClass = SupportDashboardActivity.class.getName();
|
||||
data.intentAction = Intent.ACTION_MAIN;
|
||||
data.intentAction = ACTION_SUPPORT_SETTINGS;
|
||||
data.key = SUPPORT_SEARCH_INDEX_KEY;
|
||||
result.add(data);
|
||||
|
||||
|
||||
@@ -592,28 +592,32 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
return null;
|
||||
}
|
||||
|
||||
WifiConfiguration config = new WifiConfiguration();
|
||||
|
||||
WifiConfiguration config;
|
||||
if (mWifiEntry == null) {
|
||||
config = new WifiConfiguration();
|
||||
config.SSID = "\"" + mSsidView.getText().toString() + "\"";
|
||||
// If the user adds a network manually, assume that it is hidden.
|
||||
config.hiddenSSID = mHiddenSettingsSpinner.getSelectedItemPosition() == HIDDEN_NETWORK;
|
||||
} else if (!mWifiEntry.isSaved()) {
|
||||
config.SSID = "\"" + mWifiEntry.getTitle() + "\"";
|
||||
} else if (mWifiEntry.isSaved()) {
|
||||
config = new WifiConfiguration(mWifiEntry.getWifiConfiguration());
|
||||
} else {
|
||||
config.networkId = mWifiEntry.getWifiConfiguration().networkId;
|
||||
config.hiddenSSID = mWifiEntry.getWifiConfiguration().hiddenSSID;
|
||||
config = new WifiConfiguration();
|
||||
config.SSID = "\"" + mWifiEntry.getTitle() + "\"";
|
||||
}
|
||||
|
||||
config.shared = mSharedCheckBox.isChecked();
|
||||
|
||||
switch (mWifiEntrySecurity) {
|
||||
case WifiEntry.SECURITY_NONE:
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_OPEN);
|
||||
if (mWifiEntry == null || !mWifiEntry.isSaved()) {
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_OPEN);
|
||||
}
|
||||
break;
|
||||
|
||||
case WifiEntry.SECURITY_WEP:
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_WEP);
|
||||
if (mWifiEntry == null || !mWifiEntry.isSaved()) {
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_WEP);
|
||||
}
|
||||
if (mPasswordView.length() != 0) {
|
||||
int length = mPasswordView.length();
|
||||
String password = mPasswordView.getText().toString();
|
||||
@@ -628,7 +632,9 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
break;
|
||||
|
||||
case WifiEntry.SECURITY_PSK:
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_PSK);
|
||||
if (mWifiEntry == null || !mWifiEntry.isSaved()) {
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_PSK);
|
||||
}
|
||||
if (mPasswordView.length() != 0) {
|
||||
String password = mPasswordView.getText().toString();
|
||||
if (password.matches("[0-9A-Fa-f]{64}")) {
|
||||
@@ -642,13 +648,16 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
case WifiEntry.SECURITY_EAP:
|
||||
case WifiEntry.SECURITY_EAP_WPA3_ENTERPRISE:
|
||||
case WifiEntry.SECURITY_EAP_SUITE_B:
|
||||
if (mWifiEntrySecurity == WifiEntry.SECURITY_EAP_SUITE_B) {
|
||||
// allowedSuiteBCiphers will be set according to certificate type
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP_SUITE_B);
|
||||
} else if (mWifiEntrySecurity == WifiEntry.SECURITY_EAP_WPA3_ENTERPRISE) {
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP_WPA3_ENTERPRISE);
|
||||
} else {
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP);
|
||||
if (mWifiEntry == null || !mWifiEntry.isSaved()) {
|
||||
if (mWifiEntrySecurity == WifiEntry.SECURITY_EAP_SUITE_B) {
|
||||
// allowedSuiteBCiphers will be set according to certificate type
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP_SUITE_B);
|
||||
} else if (mWifiEntrySecurity == WifiEntry.SECURITY_EAP_WPA3_ENTERPRISE) {
|
||||
config.setSecurityParams(
|
||||
WifiConfiguration.SECURITY_TYPE_EAP_WPA3_ENTERPRISE);
|
||||
} else {
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP);
|
||||
}
|
||||
}
|
||||
config.enterpriseConfig = new WifiEnterpriseConfig();
|
||||
int eapMethod = mEapMethodSpinner.getSelectedItemPosition();
|
||||
@@ -790,7 +799,9 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
}
|
||||
break;
|
||||
case WifiEntry.SECURITY_SAE:
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_SAE);
|
||||
if (mWifiEntry == null || !mWifiEntry.isSaved()) {
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_SAE);
|
||||
}
|
||||
if (mPasswordView.length() != 0) {
|
||||
String password = mPasswordView.getText().toString();
|
||||
config.preSharedKey = '"' + password + '"';
|
||||
@@ -798,7 +809,9 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
break;
|
||||
|
||||
case WifiEntry.SECURITY_OWE:
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_OWE);
|
||||
if (mWifiEntry == null || !mWifiEntry.isSaved()) {
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_OWE);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (C) 2023 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.development;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class ForceEnableNotesRolePreferenceControllerTest {
|
||||
|
||||
@Mock
|
||||
private PreferenceScreen mScreen;
|
||||
@Mock
|
||||
private SwitchPreference mPreference;
|
||||
|
||||
private ForceEnableNotesRolePreferenceController mController;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mController = new ForceEnableNotesRolePreferenceController(
|
||||
RuntimeEnvironment.application) {
|
||||
private boolean mEnabled;
|
||||
|
||||
protected boolean isEnabled() {
|
||||
return mEnabled;
|
||||
}
|
||||
|
||||
protected void setEnabled(boolean enabled) {
|
||||
mEnabled = enabled;
|
||||
}
|
||||
};
|
||||
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
|
||||
mController.displayPreference(mScreen);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_enabled_preferenceShouldBeChecked() {
|
||||
mController.setEnabled(true);
|
||||
mController.updateState(mPreference);
|
||||
|
||||
verify(mPreference).setChecked(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_disabled_preferenceShouldBeUnchecked() {
|
||||
mController.setEnabled(false);
|
||||
mController.updateState(mPreference);
|
||||
|
||||
verify(mPreference).setChecked(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPreferenceChange_checked_shouldBeEnabled() {
|
||||
mController.onPreferenceChange(mPreference, true);
|
||||
|
||||
assertTrue(mController.isEnabled());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPreferenceChange_unchecked_shouldNotBeEnabled() {
|
||||
mController.onPreferenceChange(mPreference, false);
|
||||
|
||||
assertFalse(mController.isEnabled());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onDeveloperOptionsSwitchDisabled_preferenceShouldNotBeEnabled() {
|
||||
mController.onDeveloperOptionsSwitchDisabled();
|
||||
|
||||
assertFalse(mController.isEnabled());
|
||||
verify(mPreference).setEnabled(false);
|
||||
verify(mPreference).setChecked(false);
|
||||
}
|
||||
}
|
||||
@@ -176,7 +176,7 @@ public final class BatteryUsageBreakdownControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void removeAndCacheAllUnusedPreferences_removePerf_buildCacheAndRemoveAllPreference() {
|
||||
public void removeAndCacheAllUnusedPreferences_removePref_buildCacheAndRemoveAllPreference() {
|
||||
doReturn(1).when(mAppListPreferenceGroup).getPreferenceCount();
|
||||
doReturn(mPowerGaugePreference).when(mAppListPreferenceGroup).getPreference(0);
|
||||
doReturn(PREF_KEY2).when(mBatteryHistEntry).getKey();
|
||||
@@ -193,7 +193,7 @@ public final class BatteryUsageBreakdownControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void removeAndCacheAllUnusedPreferences_keepPerf_KeepAllPreference() {
|
||||
public void removeAndCacheAllUnusedPreferences_keepPref_KeepAllPreference() {
|
||||
doReturn(1).when(mAppListPreferenceGroup).getPreferenceCount();
|
||||
doReturn(mPowerGaugePreference).when(mAppListPreferenceGroup).getPreference(0);
|
||||
doReturn(PREF_KEY).when(mBatteryHistEntry).getKey();
|
||||
|
||||
@@ -102,7 +102,7 @@ public final class DataProcessManagerTest {
|
||||
AppUsageEventEntity.KEY_UID,
|
||||
AppUsageEventEntity.KEY_PACKAGE_NAME,
|
||||
AppUsageEventEntity.KEY_TIMESTAMP});
|
||||
DatabaseUtils.sFakeAppUsageEventSupplier = () -> cursor;
|
||||
DatabaseUtils.sFakeSupplier = () -> cursor;
|
||||
doReturn(true).when(mUserManager).isUserUnlocked(anyInt());
|
||||
|
||||
mDataProcessManager.start();
|
||||
@@ -171,7 +171,7 @@ public final class DataProcessManagerTest {
|
||||
cursor.addRow(new Object[] {
|
||||
AppUsageEventType.ACTIVITY_STOPPED.getNumber(), /*timestamp=*/ 6, /*userId=*/ 1,
|
||||
/*instanceId=*/ 2, packageName});
|
||||
DatabaseUtils.sFakeAppUsageEventSupplier = () -> cursor;
|
||||
DatabaseUtils.sFakeSupplier = () -> cursor;
|
||||
|
||||
final DataProcessManager dataProcessManager = new DataProcessManager(
|
||||
mContext, /*handler=*/ null, /*rawStartTimestamp=*/ 2L, /*callbackFunction=*/ null,
|
||||
@@ -240,7 +240,7 @@ public final class DataProcessManagerTest {
|
||||
AppUsageEventEntity.KEY_TIMESTAMP});
|
||||
// Adds fake data into the cursor.
|
||||
cursor.addRow(new Object[] {101L, "app name1", 1001L});
|
||||
DatabaseUtils.sFakeAppUsageEventSupplier = () -> cursor;
|
||||
DatabaseUtils.sFakeSupplier = () -> cursor;
|
||||
|
||||
mDataProcessManager.start();
|
||||
|
||||
|
||||
@@ -261,7 +261,7 @@ public final class DatabaseUtilsTest {
|
||||
public void getAppUsageStartTimestampOfUser_emptyCursorContent_returnEarliestTimestamp() {
|
||||
final MatrixCursor cursor =
|
||||
new MatrixCursor(new String[] {AppUsageEventEntity.KEY_TIMESTAMP});
|
||||
DatabaseUtils.sFakeAppUsageLatestTimestampSupplier = () -> cursor;
|
||||
DatabaseUtils.sFakeSupplier = () -> cursor;
|
||||
|
||||
final long earliestTimestamp = 10001L;
|
||||
assertThat(DatabaseUtils.getAppUsageStartTimestampOfUser(
|
||||
@@ -270,7 +270,7 @@ public final class DatabaseUtilsTest {
|
||||
|
||||
@Test
|
||||
public void getAppUsageStartTimestampOfUser_nullCursor_returnEarliestTimestamp() {
|
||||
DatabaseUtils.sFakeAppUsageLatestTimestampSupplier = () -> null;
|
||||
DatabaseUtils.sFakeSupplier = () -> null;
|
||||
final long earliestTimestamp = 10001L;
|
||||
assertThat(DatabaseUtils.getAppUsageStartTimestampOfUser(
|
||||
mContext, /*userId=*/ 0, earliestTimestamp)).isEqualTo(earliestTimestamp);
|
||||
@@ -283,7 +283,7 @@ public final class DatabaseUtilsTest {
|
||||
new MatrixCursor(new String[] {AppUsageEventEntity.KEY_TIMESTAMP});
|
||||
// Adds fake data into the cursor.
|
||||
cursor.addRow(new Object[] {returnedTimestamp});
|
||||
DatabaseUtils.sFakeAppUsageLatestTimestampSupplier = () -> cursor;
|
||||
DatabaseUtils.sFakeSupplier = () -> cursor;
|
||||
|
||||
final long earliestTimestamp1 = 1001L;
|
||||
assertThat(DatabaseUtils.getAppUsageStartTimestampOfUser(
|
||||
@@ -302,7 +302,7 @@ public final class DatabaseUtilsTest {
|
||||
AppUsageEventEntity.KEY_PACKAGE_NAME,
|
||||
AppUsageEventEntity.KEY_TIMESTAMP,
|
||||
AppUsageEventEntity.KEY_APP_USAGE_EVENT_TYPE});
|
||||
DatabaseUtils.sFakeAppUsageEventSupplier = () -> cursor;
|
||||
DatabaseUtils.sFakeSupplier = () -> cursor;
|
||||
|
||||
assertThat(DatabaseUtils.getAppUsageEventForUsers(
|
||||
mContext,
|
||||
@@ -313,7 +313,7 @@ public final class DatabaseUtilsTest {
|
||||
|
||||
@Test
|
||||
public void getAppUsageEventForUsers_nullCursor_returnEmptyMap() {
|
||||
DatabaseUtils.sFakeAppUsageEventSupplier = () -> null;
|
||||
DatabaseUtils.sFakeSupplier = () -> null;
|
||||
assertThat(DatabaseUtils.getAppUsageEventForUsers(
|
||||
mContext,
|
||||
/*calendar=*/ null,
|
||||
@@ -335,7 +335,7 @@ public final class DatabaseUtilsTest {
|
||||
cursor.addRow(new Object[] {101L, "app name2", timestamp2});
|
||||
cursor.addRow(new Object[] {101L, "app name3", timestamp2});
|
||||
cursor.addRow(new Object[] {101L, "app name4", timestamp2});
|
||||
DatabaseUtils.sFakeAppUsageEventSupplier = () -> cursor;
|
||||
DatabaseUtils.sFakeSupplier = () -> cursor;
|
||||
|
||||
final List<AppUsageEvent> appUsageEventList = DatabaseUtils.getAppUsageEventForUsers(
|
||||
mContext,
|
||||
@@ -356,7 +356,7 @@ public final class DatabaseUtilsTest {
|
||||
BatteryHistEntry.KEY_UID,
|
||||
BatteryHistEntry.KEY_USER_ID,
|
||||
BatteryHistEntry.KEY_TIMESTAMP});
|
||||
DatabaseUtils.sFakeBatteryStateSupplier = () -> cursor;
|
||||
DatabaseUtils.sFakeSupplier = () -> cursor;
|
||||
|
||||
assertThat(DatabaseUtils.getHistoryMapSinceLastFullCharge(
|
||||
mContext, /*calendar=*/ null)).isEmpty();
|
||||
@@ -364,7 +364,7 @@ public final class DatabaseUtilsTest {
|
||||
|
||||
@Test
|
||||
public void getHistoryMapSinceLastFullCharge_nullCursor_returnEmptyMap() {
|
||||
DatabaseUtils.sFakeBatteryStateSupplier = () -> null;
|
||||
DatabaseUtils.sFakeSupplier = () -> null;
|
||||
assertThat(DatabaseUtils.getHistoryMapSinceLastFullCharge(
|
||||
mContext, /*calendar=*/ null)).isEmpty();
|
||||
}
|
||||
@@ -383,7 +383,7 @@ public final class DatabaseUtilsTest {
|
||||
"app name3", timestamp2, 3, ConvertUtils.CONSUMER_TYPE_UID_BATTERY});
|
||||
cursor.addRow(new Object[] {
|
||||
"app name4", timestamp2, 4, ConvertUtils.CONSUMER_TYPE_UID_BATTERY});
|
||||
DatabaseUtils.sFakeBatteryStateSupplier = () -> cursor;
|
||||
DatabaseUtils.sFakeSupplier = () -> cursor;
|
||||
|
||||
final Map<Long, Map<String, BatteryHistEntry>> batteryHistMap =
|
||||
DatabaseUtils.getHistoryMapSinceLastFullCharge(
|
||||
@@ -413,7 +413,7 @@ public final class DatabaseUtilsTest {
|
||||
doReturn(true).when(mUserManager).isManagedProfile();
|
||||
doReturn(UserHandle.SYSTEM).when(mUserManager).getProfileParent(UserHandle.CURRENT);
|
||||
|
||||
DatabaseUtils.sFakeBatteryStateSupplier = () -> getMatrixCursor();
|
||||
DatabaseUtils.sFakeSupplier = () -> getMatrixCursor();
|
||||
|
||||
final Map<Long, Map<String, BatteryHistEntry>> batteryHistMap =
|
||||
DatabaseUtils.getHistoryMapSinceLastFullCharge(
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.support;
|
||||
|
||||
import static com.android.settings.support.SupportDashboardActivity.ACTION_SUPPORT_SETTINGS;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.content.Context;
|
||||
@@ -59,7 +61,7 @@ public class SupportDashboardActivityTest {
|
||||
mContext.getString(R.string.page_tab_title_support));
|
||||
assertThat(value.intentTargetPackage).isEqualTo(mContext.getPackageName());
|
||||
assertThat(value.intentTargetClass).isEqualTo(SupportDashboardActivity.class.getName());
|
||||
assertThat(value.intentAction).isEqualTo(Intent.ACTION_MAIN);
|
||||
assertThat(value.intentAction).isEqualTo(ACTION_SUPPORT_SETTINGS);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -470,7 +470,7 @@ public class WifiConfigController2Test {
|
||||
|
||||
private void checkSavedMacRandomizedValue(int macRandomizedValue) {
|
||||
when(mWifiEntry.isSaved()).thenReturn(true);
|
||||
final WifiConfiguration mockWifiConfig = mock(WifiConfiguration.class);
|
||||
final WifiConfiguration mockWifiConfig = spy(new WifiConfiguration());
|
||||
when(mockWifiConfig.getIpConfiguration()).thenReturn(mock(IpConfiguration.class));
|
||||
when(mWifiEntry.getWifiConfiguration()).thenReturn(mockWifiConfig);
|
||||
mockWifiConfig.macRandomizationSetting = macRandomizedValue;
|
||||
@@ -809,9 +809,10 @@ public class WifiConfigController2Test {
|
||||
private void setUpModifyingSavedPeapConfigController() {
|
||||
when(mWifiEntry.isSaved()).thenReturn(true);
|
||||
when(mWifiEntry.getSecurity()).thenReturn(WifiEntry.SECURITY_EAP);
|
||||
final WifiConfiguration mockWifiConfig = mock(WifiConfiguration.class);
|
||||
final WifiConfiguration mockWifiConfig = spy(new WifiConfiguration());
|
||||
mockWifiConfig.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP);
|
||||
when(mockWifiConfig.getIpConfiguration()).thenReturn(mock(IpConfiguration.class));
|
||||
final WifiEnterpriseConfig mockWifiEnterpriseConfig = mock(WifiEnterpriseConfig.class);
|
||||
final WifiEnterpriseConfig mockWifiEnterpriseConfig = spy(new WifiEnterpriseConfig());
|
||||
when(mockWifiEnterpriseConfig.getEapMethod()).thenReturn(Eap.PEAP);
|
||||
mockWifiConfig.enterpriseConfig = mockWifiEnterpriseConfig;
|
||||
when(mWifiEntry.getWifiConfiguration()).thenReturn(mockWifiConfig);
|
||||
@@ -980,8 +981,8 @@ public class WifiConfigController2Test {
|
||||
|
||||
private void setUpModifyingSavedCertificateConfigController(String savedCaCertificate,
|
||||
String savedUserCertificate) {
|
||||
final WifiConfiguration mockWifiConfig = mock(WifiConfiguration.class);
|
||||
final WifiEnterpriseConfig mockWifiEnterpriseConfig = mock(WifiEnterpriseConfig.class);
|
||||
final WifiConfiguration mockWifiConfig = spy(new WifiConfiguration());
|
||||
final WifiEnterpriseConfig mockWifiEnterpriseConfig = spy(new WifiEnterpriseConfig());
|
||||
|
||||
mockWifiConfig.enterpriseConfig = mockWifiEnterpriseConfig;
|
||||
when(mWifiEntry.isSaved()).thenReturn(true);
|
||||
|
||||
@@ -33,6 +33,7 @@ import android.support.test.uiautomator.UiDevice;
|
||||
import android.support.test.uiautomator.UiObject2;
|
||||
import android.support.test.uiautomator.Until;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
@@ -54,18 +55,25 @@ public class FingerprintEnrollmentActivityTest {
|
||||
private static final String SETTINGS_PACKAGE_NAME = "com.android.settings";
|
||||
private static final String ACTIVITY_CLASS_NAME =
|
||||
"com.android.settings.biometrics2.ui.view.FingerprintEnrollmentActivity";
|
||||
public static final String EXTRA_IS_SETUP_FLOW = "isSetupFlow";
|
||||
private static final String EXTRA_IS_SETUP_FLOW = "isSetupFlow";
|
||||
private static final String EXTRA_SKIP_FIND_SENSOR = "skip_find_sensor";
|
||||
private static final String EXTRA_FROM_SETTINGS_SUMMARY = "from_settings_summary";
|
||||
private static final String EXTRA_PAGE_TRANSITION_TYPE = "page_transition_type";
|
||||
private static final String EXTRA_KEY_GK_PW_HANDLE = "gk_pw_handle";
|
||||
private static final String TEST_PIN = "1234";
|
||||
|
||||
private static final String UDFPS_ENROLLING_TITLE = "Touch & hold the fingerprint sensor";
|
||||
private static final String SFPS_ENROLLING_TITLE =
|
||||
"Lift, then touch. Move your finger slightly each time.";
|
||||
private static final String RFPS_ENROLLING_TITLE = "Lift, then touch again";
|
||||
|
||||
private UiDevice mDevice;
|
||||
private byte[] mToken = new byte[]{};
|
||||
private Context mContext;
|
||||
private boolean mFingerprintPropCallbackLaunched;
|
||||
private boolean mCanAssumeUdfps;
|
||||
private boolean mCanAssumeSfps;
|
||||
private String mEnrollingTitle;
|
||||
|
||||
private static final int IDLE_TIMEOUT = 10000;
|
||||
|
||||
@@ -94,6 +102,13 @@ public class FingerprintEnrollmentActivityTest {
|
||||
final FingerprintSensorPropertiesInternal prop = list.get(0);
|
||||
mCanAssumeUdfps = prop.isAnyUdfpsType();
|
||||
mCanAssumeSfps = prop.isAnySidefpsType();
|
||||
if (mCanAssumeUdfps) {
|
||||
mEnrollingTitle = UDFPS_ENROLLING_TITLE;
|
||||
} else if (mCanAssumeSfps) {
|
||||
mEnrollingTitle = SFPS_ENROLLING_TITLE;
|
||||
} else {
|
||||
mEnrollingTitle = RFPS_ENROLLING_TITLE;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -106,8 +121,9 @@ public class FingerprintEnrollmentActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchChooseLock() {
|
||||
launchFingerprintEnrollActivity(false, null);
|
||||
public void testIntroChooseLock() {
|
||||
final Intent intent = newActivityIntent();
|
||||
mContext.startActivity(intent);
|
||||
assertThat(mDevice.wait(Until.hasObject(By.text("Choose your backup screen lock method")),
|
||||
IDLE_TIMEOUT)).isTrue();
|
||||
}
|
||||
@@ -135,12 +151,12 @@ public class FingerprintEnrollmentActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchWithGkPwHandle_withUdfps_clickStart() {
|
||||
public void testIntroWithGkPwHandle_withUdfps_clickStart() {
|
||||
assumeTrue(mCanAssumeUdfps);
|
||||
|
||||
LockScreenUtil.setLockscreen(LockScreenUtil.LockscreenType.PIN, TEST_PIN, true);
|
||||
|
||||
launchFingerprintEnrollActivityWithGkPwHandle(false);
|
||||
launchIntroWithGkPwHandle(false);
|
||||
|
||||
// Intro page
|
||||
verifyIntroPage();
|
||||
@@ -159,17 +175,16 @@ public class FingerprintEnrollmentActivityTest {
|
||||
startBtn.click();
|
||||
|
||||
// Enrolling page
|
||||
assertThat(mDevice.wait(Until.hasObject(By.text("Touch & hold the fingerprint sensor")),
|
||||
IDLE_TIMEOUT)).isTrue();
|
||||
assertThat(mDevice.wait(Until.hasObject(By.text(mEnrollingTitle)), IDLE_TIMEOUT)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchWithGkPwHandle_withUdfps_clickLottie() {
|
||||
public void testIntroWithGkPwHandle_withUdfps_clickLottie() {
|
||||
assumeTrue(mCanAssumeUdfps);
|
||||
|
||||
LockScreenUtil.setLockscreen(LockScreenUtil.LockscreenType.PIN, TEST_PIN, true);
|
||||
|
||||
launchFingerprintEnrollActivityWithGkPwHandle(false);
|
||||
launchIntroWithGkPwHandle(false);
|
||||
|
||||
// Intro page
|
||||
verifyIntroPage();
|
||||
@@ -188,17 +203,16 @@ public class FingerprintEnrollmentActivityTest {
|
||||
lottie.click();
|
||||
|
||||
// Enrolling page
|
||||
assertThat(mDevice.wait(Until.hasObject(By.text("Touch & hold the fingerprint sensor")),
|
||||
IDLE_TIMEOUT)).isTrue();
|
||||
assertThat(mDevice.wait(Until.hasObject(By.text(mEnrollingTitle)), IDLE_TIMEOUT)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchWithGkPwHandle_withSfps() {
|
||||
public void testIntroWithGkPwHandle_withSfps() {
|
||||
assumeTrue(mCanAssumeSfps);
|
||||
|
||||
LockScreenUtil.setLockscreen(LockScreenUtil.LockscreenType.PIN, TEST_PIN, true);
|
||||
|
||||
launchFingerprintEnrollActivityWithGkPwHandle(false);
|
||||
launchIntroWithGkPwHandle(false);
|
||||
|
||||
// Intro page
|
||||
verifyIntroPage();
|
||||
@@ -216,12 +230,12 @@ public class FingerprintEnrollmentActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchWithGkPwHandle_withRfps() {
|
||||
public void testIntroWithGkPwHandle_withRfps() {
|
||||
assumeFalse(mCanAssumeUdfps || mCanAssumeSfps);
|
||||
|
||||
LockScreenUtil.setLockscreen(LockScreenUtil.LockscreenType.PIN, TEST_PIN, true);
|
||||
|
||||
launchFingerprintEnrollActivityWithGkPwHandle(false);
|
||||
launchIntroWithGkPwHandle(false);
|
||||
|
||||
// Intro page
|
||||
verifyIntroPage();
|
||||
@@ -241,10 +255,10 @@ public class FingerprintEnrollmentActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchWithGkPwHandle_clickNoThanksInIntroPage() {
|
||||
public void testIntroWithGkPwHandle_clickNoThanksInIntroPage() {
|
||||
LockScreenUtil.setLockscreen(LockScreenUtil.LockscreenType.PIN, TEST_PIN, true);
|
||||
|
||||
launchFingerprintEnrollActivityWithGkPwHandle(false);
|
||||
launchIntroWithGkPwHandle(false);
|
||||
|
||||
// Intro page
|
||||
verifyIntroPage();
|
||||
@@ -258,10 +272,10 @@ public class FingerprintEnrollmentActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchWithGkPwHandle_clickSkipInFindSensor() {
|
||||
public void testIntroWithGkPwHandle_clickSkipInFindSensor() {
|
||||
LockScreenUtil.setLockscreen(LockScreenUtil.LockscreenType.PIN, TEST_PIN, true);
|
||||
|
||||
launchFingerprintEnrollActivityWithGkPwHandle(false);
|
||||
launchIntroWithGkPwHandle(false);
|
||||
|
||||
// Intro page
|
||||
verifyIntroPage();
|
||||
@@ -282,10 +296,10 @@ public class FingerprintEnrollmentActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchWithGkPwHandle_clickSkipAnywayInFindFpsDialog_whenIsSuw() {
|
||||
public void testIntroWithGkPwHandle_clickSkipAnywayInFindFpsDialog_whenIsSuw() {
|
||||
LockScreenUtil.setLockscreen(LockScreenUtil.LockscreenType.PIN, TEST_PIN, true);
|
||||
|
||||
launchFingerprintEnrollActivityWithGkPwHandle(true);
|
||||
launchIntroWithGkPwHandle(true);
|
||||
|
||||
// Intro page
|
||||
verifyIntroPage();
|
||||
@@ -315,10 +329,10 @@ public class FingerprintEnrollmentActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchWithGkPwHandle_clickGoBackInFindFpsDialog_whenIsSuw() {
|
||||
public void testIntroWithGkPwHandle_clickGoBackInFindFpsDialog_whenIsSuw() {
|
||||
LockScreenUtil.setLockscreen(LockScreenUtil.LockscreenType.PIN, TEST_PIN, true);
|
||||
|
||||
launchFingerprintEnrollActivityWithGkPwHandle(true);
|
||||
launchIntroWithGkPwHandle(true);
|
||||
|
||||
// Intro page
|
||||
verifyIntroPage();
|
||||
@@ -346,43 +360,138 @@ public class FingerprintEnrollmentActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchCheckPin() {
|
||||
public void testIntroCheckPin() {
|
||||
LockScreenUtil.setLockscreen(LockScreenUtil.LockscreenType.PIN, TEST_PIN, true);
|
||||
launchFingerprintEnrollActivity(false, null);
|
||||
final Intent intent = newActivityIntent();
|
||||
mContext.startActivity(intent);
|
||||
assertThat(mDevice.wait(Until.hasObject(By.text("Enter your device PIN to continue")),
|
||||
IDLE_TIMEOUT)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEnrollingWithGkPwHandle() {
|
||||
LockScreenUtil.setLockscreen(LockScreenUtil.LockscreenType.PIN, TEST_PIN, true);
|
||||
|
||||
launchEnrollingWithGkPwHandle();
|
||||
|
||||
// Enrolling screen
|
||||
mDevice.waitForIdle();
|
||||
assertThat(mDevice.wait(Until.hasObject(By.text(mEnrollingTitle)), IDLE_TIMEOUT)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEnrollingIconTouchDialog_withSfps() {
|
||||
assumeTrue(mCanAssumeSfps);
|
||||
|
||||
LockScreenUtil.setLockscreen(LockScreenUtil.LockscreenType.PIN, TEST_PIN, true);
|
||||
|
||||
launchEnrollingWithGkPwHandle();
|
||||
|
||||
// Enrolling screen
|
||||
mDevice.waitForIdle();
|
||||
assertThat(mDevice.wait(Until.hasObject(By.text(mEnrollingTitle)), IDLE_TIMEOUT)).isTrue();
|
||||
|
||||
final UiObject2 lottie = mDevice.findObject(By.res(SETTINGS_PACKAGE_NAME,
|
||||
"illustration_lottie"));
|
||||
assertThat(lottie).isNotNull();
|
||||
|
||||
lottie.click();
|
||||
lottie.click();
|
||||
lottie.click();
|
||||
|
||||
// IconTouchDialog
|
||||
mDevice.waitForIdle();
|
||||
assertThat(mDevice.wait(Until.hasObject(By.text("Touch the sensor instead")), IDLE_TIMEOUT))
|
||||
.isTrue();
|
||||
final UiObject2 okButton = mDevice.findObject(By.text("OK"));
|
||||
assertThat(okButton).isNotNull();
|
||||
|
||||
okButton.click();
|
||||
|
||||
// Enrolling screen again
|
||||
mDevice.waitForIdle();
|
||||
assertThat(mDevice.wait(Until.hasObject(By.text(mEnrollingTitle)), IDLE_TIMEOUT)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEnrollingIconTouchDialog_withRfps() {
|
||||
assumeFalse(mCanAssumeUdfps || mCanAssumeSfps);
|
||||
|
||||
LockScreenUtil.setLockscreen(LockScreenUtil.LockscreenType.PIN, TEST_PIN, true);
|
||||
|
||||
launchEnrollingWithGkPwHandle();
|
||||
|
||||
// Enrolling screen
|
||||
mDevice.waitForIdle();
|
||||
assertThat(mDevice.wait(Until.hasObject(By.text(mEnrollingTitle)), IDLE_TIMEOUT)).isTrue();
|
||||
|
||||
final UiObject2 lottie = mDevice.findObject(By.res(SETTINGS_PACKAGE_NAME,
|
||||
"fingerprint_progress_bar"));
|
||||
assertThat(lottie).isNotNull();
|
||||
|
||||
lottie.click();
|
||||
lottie.click();
|
||||
lottie.click();
|
||||
|
||||
// IconTouchDialog
|
||||
mDevice.waitForIdle();
|
||||
assertThat(mDevice.wait(Until.hasObject(By.text("Whoops, that\u2019s not the sensor")),
|
||||
IDLE_TIMEOUT)).isTrue();
|
||||
final UiObject2 okButton = mDevice.findObject(By.text("OK"));
|
||||
assertThat(okButton).isNotNull();
|
||||
|
||||
okButton.click();
|
||||
|
||||
// Enrolling screen again
|
||||
mDevice.waitForIdle();
|
||||
assertThat(mDevice.wait(Until.hasObject(By.text(mEnrollingTitle)), IDLE_TIMEOUT)).isTrue();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
LockScreenUtil.resetLockscreen(TEST_PIN);
|
||||
mDevice.pressHome();
|
||||
}
|
||||
|
||||
private void launchFingerprintEnrollActivityWithGkPwHandle(boolean isSuw) {
|
||||
private void launchIntroWithGkPwHandle(boolean isSuw) {
|
||||
LockPatternUtils lockPatternUtils = new LockPatternUtils(mContext);
|
||||
final LockscreenCredential lockscreenCredential = LockscreenCredential.createPin(TEST_PIN);
|
||||
final int userId = UserHandle.myUserId();
|
||||
final LockPatternChecker.OnVerifyCallback onVerifyCallback = (response, timeoutMs) -> {
|
||||
launchFingerprintEnrollActivity(isSuw, response.getGatekeeperPasswordHandle());
|
||||
final Intent intent = newActivityIntent();
|
||||
if (isSuw) {
|
||||
intent.putExtra(EXTRA_IS_SETUP_FLOW, true);
|
||||
}
|
||||
intent.putExtra(EXTRA_KEY_GK_PW_HANDLE, response.getGatekeeperPasswordHandle());
|
||||
mContext.startActivity(intent);
|
||||
};
|
||||
LockPatternChecker.verifyCredential(lockPatternUtils, lockscreenCredential,
|
||||
userId, LockPatternUtils.VERIFY_FLAG_REQUEST_GK_PW_HANDLE, onVerifyCallback);
|
||||
}
|
||||
|
||||
private void launchFingerprintEnrollActivity(boolean isSuw, Long gkPwHandle) {
|
||||
private void launchEnrollingWithGkPwHandle() {
|
||||
LockPatternUtils lockPatternUtils = new LockPatternUtils(mContext);
|
||||
final LockscreenCredential lockscreenCredential = LockscreenCredential.createPin(TEST_PIN);
|
||||
final int userId = UserHandle.myUserId();
|
||||
final LockPatternChecker.OnVerifyCallback onVerifyCallback = (response, timeoutMs) -> {
|
||||
final Intent intent = newActivityIntent();
|
||||
intent.putExtra(EXTRA_SKIP_FIND_SENSOR, true);
|
||||
intent.putExtra(EXTRA_KEY_GK_PW_HANDLE, response.getGatekeeperPasswordHandle());
|
||||
mContext.startActivity(intent);
|
||||
};
|
||||
LockPatternChecker.verifyCredential(lockPatternUtils, lockscreenCredential,
|
||||
userId, LockPatternUtils.VERIFY_FLAG_REQUEST_GK_PW_HANDLE, onVerifyCallback);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private Intent newActivityIntent() {
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName(SETTINGS_PACKAGE_NAME, ACTIVITY_CLASS_NAME);
|
||||
if (isSuw) {
|
||||
intent.putExtra(EXTRA_IS_SETUP_FLOW, true);
|
||||
}
|
||||
intent.putExtra(EXTRA_FROM_SETTINGS_SUMMARY, true);
|
||||
intent.putExtra(EXTRA_PAGE_TRANSITION_TYPE, 1);
|
||||
intent.putExtra(Intent.EXTRA_USER_ID, mContext.getUserId());
|
||||
if (gkPwHandle != null) {
|
||||
intent.putExtra(EXTRA_KEY_GK_PW_HANDLE, gkPwHandle);
|
||||
}
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(intent);
|
||||
return intent;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_UDFP
|
||||
import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_UDFPS_ULTRASONIC;
|
||||
|
||||
import static com.android.settings.biometrics2.ui.viewmodel.FingerprintEnrollEnrollingViewModel.ErrorDialogData;
|
||||
import static com.android.settings.biometrics2.ui.viewmodel.FingerprintEnrollEnrollingViewModel.FINGERPRINT_ENROLL_ENROLLING_ACTION_DISMISS_ICON_TOUCH_DIALOG;
|
||||
import static com.android.settings.biometrics2.ui.viewmodel.FingerprintEnrollEnrollingViewModel.FINGERPRINT_ENROLL_ENROLLING_ACTION_SHOW_ICON_TOUCH_DIALOG;
|
||||
import static com.android.settings.biometrics2.ui.viewmodel.FingerprintEnrollEnrollingViewModel.FINGERPRINT_ENROLL_ENROLLING_CANCELED_BECAUSE_BACK_PRESSED;
|
||||
import static com.android.settings.biometrics2.ui.viewmodel.FingerprintEnrollEnrollingViewModel.FINGERPRINT_ENROLL_ENROLLING_CANCELED_BECAUSE_USER_SKIP;
|
||||
@@ -103,10 +102,6 @@ public class FingerprintEnrollEnrollingViewModelTest {
|
||||
mViewModel.showIconTouchDialog();
|
||||
assertThat(actionLiveData.getValue()).isEqualTo(
|
||||
FINGERPRINT_ENROLL_ENROLLING_ACTION_SHOW_ICON_TOUCH_DIALOG);
|
||||
|
||||
mViewModel.onIconTouchDialogDismiss();
|
||||
assertThat(actionLiveData.getValue()).isEqualTo(
|
||||
FINGERPRINT_ENROLL_ENROLLING_ACTION_DISMISS_ICON_TOUCH_DIALOG);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user