Snap for 7775125 from e893a890ca to sc-v2-release
Change-Id: I16c7bdd000aff30b5db2283fde6d19bec59872c9
This commit is contained in:
@@ -178,6 +178,7 @@
|
||||
<activity-alias android:name="DeepLinkHomepageActivity"
|
||||
android:label="@string/settings_label_launcher"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.LAUNCH_TWO_PANE_SETTINGS_DEEP_LINK"
|
||||
android:targetActivity=".homepage.SettingsHomepageActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.settings.SETTINGS_LARGE_SCREEN_DEEP_LINK" />
|
||||
|
||||
@@ -997,12 +997,16 @@
|
||||
<string name="biometric_settings_intro">When you set up Face Unlock and Fingerprint Unlock, your phone will ask for your fingerprint when you wear a mask or are in a dark area</string>
|
||||
<!-- Biometric category title - biometric options for unlocking the device. [CHAR LIMIT=50] -->
|
||||
<string name="biometric_settings_category_ways_to_unlock">Ways to unlock</string>
|
||||
<!-- Biometric category title - configuration options for using biometric to unlock the device or authenticate in apps. [CHAR LIMIT=50] -->
|
||||
<string name="biometric_settings_category_ways_to_use">Use face and fingerprint for</string>
|
||||
<!-- Text shown on a toggle which allows or disallows the device to use biometric for unlocking the device. [CHAR LIMIT=50] -->
|
||||
<string name="biometric_settings_use_biometric_unlock_phone">Unlocking your phone</string>
|
||||
<string name="biometric_settings_use_biometric_unlock_phone">Unlock your phone</string>
|
||||
<!-- Text shown on a toggle which allows or disallows the device to use biometric for authentication. [CHAR LIMIT=50] -->
|
||||
<string name="biometric_settings_use_biometric_for_apps">Authentication in apps</string>
|
||||
<string name="biometric_settings_use_biometric_for_apps">Verify it\u2019s you in apps</string>
|
||||
<!-- Message for a biometric preference toggle, indicating that an action can only be performed by using Face Unlock. [CHAR LIMIT=50] -->
|
||||
<string name="biometric_settings_use_face_preference_summary">Using face</string>
|
||||
<!-- Message for a biometric preference toggle, indicating that an action can only be performed by using Fingerprint Unlock. [CHAR LIMIT=50] -->
|
||||
<string name="biometric_settings_use_fingerprint_preference_summary">Using fingerprint</string>
|
||||
<!-- Message for a biometric preference toggle, indicating that an action can be performed by using either Face Unlock or Fingerprint Unlock. [CHAR LIMIT=50] -->
|
||||
<string name="biometric_settings_use_face_or_fingerprint_preference_summary">Using face or fingerprint</string>
|
||||
<!-- Message shown during enrollment to prompt a child to give the device to a parent or guardian. [CHAR LIMIT=NONE]-->
|
||||
<string name="biometric_settings_hand_back_to_guardian">Hand the phone back to your parent</string>
|
||||
<!-- Button text shown during enrollment to proceed after a child user has handed the device to a parent or guardian. [CHAR LIMIT=22] -->
|
||||
@@ -1242,25 +1246,6 @@
|
||||
<!-- Button to confirm the last removing the last fingerprint. [CHAR LIMIT=20]-->
|
||||
<string name="fingerprint_last_delete_confirm">Yes, remove</string>
|
||||
|
||||
<!-- Title of the combined biometrics settings screen. [CHAR LIMIT=40] -->
|
||||
<string name="security_settings_biometrics_title">Face \u0026 fingerprint unlock</string>
|
||||
<!-- Summary of the current biometrics setting when no biometrics have been enrolled. [CHAR LIMIT=50] -->
|
||||
<string name="security_settings_biometrics_summary_none">Tap to set up</string>
|
||||
<!-- Summary of the current biometrics setting when the user has enrolled a face but no fingerprint. [CHAR LIMIT=50] -->
|
||||
<string name="security_settings_biometrics_summary_face">Face only</string>
|
||||
<!-- Summary of the current biometrics setting when the user has enrolled a fingerprint but no face. [CHAR LIMIT=50] -->
|
||||
<string name="security_settings_biometrics_summary_fingerprint">Fingerprint only</string>
|
||||
<!-- Summary of the current biometrics setting when the user has enrolled both a face and a fingerprint. [CHAR LIMIT=50] -->
|
||||
<string name="security_settings_biometrics_summary_both">Face and fingerprint</string>
|
||||
<!-- Description shown on the combined biometrics settings screen. [CHAR LIMIT=NONE] -->
|
||||
<string name="security_settings_biometrics_description">When you set up face and fingerprint unlock, your phone will ask for your fingerprint when you wear a mask or are in a dark area</string>
|
||||
<!-- Title of a section on the biometrics settings screen for setting up different types of authentication. [CHAR LIMIT=50] -->
|
||||
<string name="security_settings_biometrics_types_category">Ways to unlock</string>
|
||||
<!-- Title of a section on the biometrics settings screen for adjusting authentication preferences. [CHAR LIMIT=50] -->
|
||||
<string name="security_settings_biometrics_preferences_category">Use face or fingerprint for</string>
|
||||
<!-- Title of a section on the biometrics settings screen for adjusting authentication preferences. [CHAR LIMIT=50] -->
|
||||
<string name="security_settings_biometrics_preference_use_with_apps">Authentication in apps</string>
|
||||
|
||||
<!-- Title of the preferences category for preference items to control encryption -->
|
||||
<string name="crypt_keeper_settings_title">Encryption</string>
|
||||
|
||||
|
||||
@@ -43,8 +43,7 @@
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="biometric_ways_to_use"
|
||||
android:title="@string/biometric_settings_category_ways_to_use">
|
||||
android:key="biometric_ways_to_use">
|
||||
|
||||
<com.android.settingslib.RestrictedSwitchPreference
|
||||
android:key="biometric_settings_biometric_keyguard"
|
||||
|
||||
@@ -43,8 +43,7 @@
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="biometric_ways_to_use"
|
||||
android:title="@string/biometric_settings_category_ways_to_use">
|
||||
android:key="biometric_ways_to_use">
|
||||
|
||||
<SwitchPreference
|
||||
android:key="biometric_settings_biometric_app_profile"
|
||||
|
||||
@@ -17,16 +17,22 @@
|
||||
package com.android.settings.accessibility;
|
||||
|
||||
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU;
|
||||
import static android.view.WindowInsets.Type.displayCutout;
|
||||
import static android.view.WindowInsets.Type.systemBars;
|
||||
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
|
||||
|
||||
import android.accessibilityservice.AccessibilityServiceInfo;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Insets;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.TypedValue;
|
||||
import android.view.WindowManager;
|
||||
import android.view.WindowMetrics;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
|
||||
import androidx.annotation.IntDef;
|
||||
@@ -390,6 +396,25 @@ final class AccessibilityUtil {
|
||||
resources.getDisplayMetrics()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bounds of the display window excluding the insets of the system bar and display
|
||||
* cut out.
|
||||
*
|
||||
* @param context the current context.
|
||||
* @return the bounds of the display window.
|
||||
*/
|
||||
public static Rect getDisplayBounds(Context context) {
|
||||
final WindowManager windowManager = context.getSystemService(WindowManager.class);
|
||||
final WindowMetrics metrics = windowManager.getCurrentWindowMetrics();
|
||||
|
||||
final Rect displayBounds = metrics.getBounds();
|
||||
final Insets displayInsets = metrics.getWindowInsets().getInsetsIgnoringVisibility(
|
||||
systemBars() | displayCutout());
|
||||
displayBounds.inset(displayInsets);
|
||||
|
||||
return displayBounds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if the accessibility service belongs to a system App.
|
||||
* @param info AccessibilityServiceInfo
|
||||
|
||||
@@ -406,10 +406,13 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
||||
return;
|
||||
}
|
||||
|
||||
final int displayHalfHeight =
|
||||
AccessibilityUtil.getDisplayBounds(getPrefContext()).height() / 2;
|
||||
final IllustrationPreference illustrationPreference =
|
||||
new IllustrationPreference(getPrefContext());
|
||||
illustrationPreference.setImageUri(mImageUri);
|
||||
illustrationPreference.setSelectable(false);
|
||||
illustrationPreference.setMaxHeight(displayHalfHeight);
|
||||
illustrationPreference.setKey(KEY_ANIMATED_IMAGE);
|
||||
|
||||
getPreferenceScreen().addPreference(illustrationPreference);
|
||||
|
||||
@@ -21,13 +21,18 @@ import static com.android.settings.password.ChooseLockPattern.RESULT_FINISHED;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.hardware.biometrics.SensorProperties;
|
||||
import android.hardware.face.FaceManager;
|
||||
import android.hardware.face.FaceSensorPropertiesInternal;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.R;
|
||||
@@ -90,6 +95,16 @@ public abstract class BiometricsSettingsBase extends DashboardFragment {
|
||||
mConfirmCredential = true;
|
||||
launchChooseOrConfirmLock();
|
||||
}
|
||||
|
||||
final Preference unlockPhonePreference = findPreference(getUnlockPhonePreferenceKey());
|
||||
if (unlockPhonePreference != null) {
|
||||
unlockPhonePreference.setSummary(getUseAnyBiometricSummary());
|
||||
}
|
||||
|
||||
final Preference useInAppsPreference = findPreference(getUseInAppsPreferenceKey());
|
||||
if (useInAppsPreference != null) {
|
||||
useInAppsPreference.setSummary(getUseClass2BiometricSummary());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -185,6 +200,16 @@ public abstract class BiometricsSettingsBase extends DashboardFragment {
|
||||
*/
|
||||
public abstract String getFingerprintPreferenceKey();
|
||||
|
||||
/**
|
||||
* @return The preference key of the "Unlock your phone" setting toggle.
|
||||
*/
|
||||
public abstract String getUnlockPhonePreferenceKey();
|
||||
|
||||
/**
|
||||
* @return The preference key of the "Verify it's you in apps" setting toggle.
|
||||
*/
|
||||
public abstract String getUseInAppsPreferenceKey();
|
||||
|
||||
private void launchChooseOrConfirmLock() {
|
||||
final ChooseLockSettingsHelper.Builder builder =
|
||||
new ChooseLockSettingsHelper.Builder(getActivity(), this)
|
||||
@@ -214,4 +239,59 @@ public abstract class BiometricsSettingsBase extends DashboardFragment {
|
||||
startActivityForResult(intent, CHOOSE_LOCK_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private String getUseAnyBiometricSummary() {
|
||||
boolean isFaceAllowed = mFaceManager != null && mFaceManager.isHardwareDetected();
|
||||
boolean isFingerprintAllowed =
|
||||
mFingerprintManager != null && mFingerprintManager.isHardwareDetected();
|
||||
|
||||
@StringRes final int resId = getUseBiometricSummaryRes(isFaceAllowed, isFingerprintAllowed);
|
||||
return resId == 0 ? "" : getString(resId);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private String getUseClass2BiometricSummary() {
|
||||
boolean isFaceAllowed = false;
|
||||
if (mFaceManager != null) {
|
||||
for (final FaceSensorPropertiesInternal sensorProps
|
||||
: mFaceManager.getSensorPropertiesInternal()) {
|
||||
if (sensorProps.sensorStrength == SensorProperties.STRENGTH_WEAK
|
||||
|| sensorProps.sensorStrength == SensorProperties.STRENGTH_STRONG) {
|
||||
isFaceAllowed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean isFingerprintAllowed = false;
|
||||
if (mFingerprintManager != null) {
|
||||
for (final FingerprintSensorPropertiesInternal sensorProps
|
||||
: mFingerprintManager.getSensorPropertiesInternal()) {
|
||||
if (sensorProps.sensorStrength == SensorProperties.STRENGTH_WEAK
|
||||
|| sensorProps.sensorStrength == SensorProperties.STRENGTH_STRONG) {
|
||||
isFingerprintAllowed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@StringRes final int resId = getUseBiometricSummaryRes(isFaceAllowed, isFingerprintAllowed);
|
||||
return resId == 0 ? "" : getString(resId);
|
||||
}
|
||||
|
||||
@StringRes
|
||||
private static int getUseBiometricSummaryRes(boolean isFaceAllowed,
|
||||
boolean isFingerprintAllowed) {
|
||||
|
||||
if (isFaceAllowed && isFingerprintAllowed) {
|
||||
return R.string.biometric_settings_use_face_or_fingerprint_preference_summary;
|
||||
} else if (isFaceAllowed) {
|
||||
return R.string.biometric_settings_use_face_preference_summary;
|
||||
} else if (isFingerprintAllowed) {
|
||||
return R.string.biometric_settings_use_fingerprint_preference_summary;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ public class CombinedBiometricProfileSettings extends BiometricsSettingsBase {
|
||||
private static final String TAG = "BiometricProfileSetting";
|
||||
private static final String KEY_FACE_SETTINGS = "biometric_face_settings_profile";
|
||||
private static final String KEY_FINGERPRINT_SETTINGS = "biometric_fingerprint_settings_profile";
|
||||
private static final String KEY_UNLOCK_PHONE = "biometric_settings_biometric_keyguard_profile";
|
||||
private static final String KEY_USE_IN_APPS = "biometric_settings_biometric_app_profile";
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
@@ -50,6 +52,16 @@ public class CombinedBiometricProfileSettings extends BiometricsSettingsBase {
|
||||
return KEY_FINGERPRINT_SETTINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlockPhonePreferenceKey() {
|
||||
return KEY_UNLOCK_PHONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUseInAppsPreferenceKey() {
|
||||
return KEY_USE_IN_APPS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getLogTag() {
|
||||
return TAG;
|
||||
|
||||
@@ -30,6 +30,8 @@ public class CombinedBiometricSettings extends BiometricsSettingsBase {
|
||||
private static final String TAG = "BiometricSettings";
|
||||
private static final String KEY_FACE_SETTINGS = "biometric_face_settings";
|
||||
private static final String KEY_FINGERPRINT_SETTINGS = "biometric_fingerprint_settings";
|
||||
private static final String KEY_UNLOCK_PHONE = "biometric_settings_biometric_keyguard";
|
||||
private static final String KEY_USE_IN_APPS = "biometric_settings_biometric_app";
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
@@ -53,6 +55,16 @@ public class CombinedBiometricSettings extends BiometricsSettingsBase {
|
||||
return KEY_FINGERPRINT_SETTINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlockPhonePreferenceKey() {
|
||||
return KEY_UNLOCK_PHONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUseInAppsPreferenceKey() {
|
||||
return KEY_USE_IN_APPS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getLogTag() {
|
||||
return TAG;
|
||||
|
||||
@@ -162,7 +162,9 @@ public class BatteryInfo {
|
||||
.getBatteryUsageStats();
|
||||
} catch (RuntimeException e) {
|
||||
Log.e(TAG, "getBatteryInfo() from getBatteryUsageStats()", e);
|
||||
return null;
|
||||
// Use default BatteryUsageStats.
|
||||
stats = new BatteryUsageStats.Builder(
|
||||
new String[0], /* includePowerModels */ false).build();
|
||||
}
|
||||
}
|
||||
return getBatteryInfo(context, stats, shortString);
|
||||
|
||||
@@ -48,7 +48,9 @@ public class BatteryUsageStatsLoader extends AsyncLoaderCompat<BatteryUsageStats
|
||||
return mBatteryStatsManager.getBatteryUsageStats(builder.build());
|
||||
} catch (RuntimeException e) {
|
||||
Log.e(TAG, "loadInBackground() for getBatteryUsageStats()", e);
|
||||
return null;
|
||||
// Use default BatteryUsageStats.
|
||||
return new BatteryUsageStats.Builder(
|
||||
new String[0], /* includePowerModels */ false).build();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -373,8 +373,11 @@ public class BatteryUtils {
|
||||
batteryUsageStats = systemService.getBatteryUsageStats(
|
||||
new BatteryUsageStatsQuery.Builder().includeBatteryHistory().build());
|
||||
} catch (RuntimeException e) {
|
||||
Log.e(TAG, "getBatteryInfo() from getBatteryUsageStats()", e);
|
||||
return null;
|
||||
Log.e(TAG, "getBatteryInfo() error from getBatteryUsageStats()", e);
|
||||
// Use default BatteryUsageStats.
|
||||
batteryUsageStats =
|
||||
new BatteryUsageStats.Builder(new String[0], /* includePowerModels */ false)
|
||||
.build();
|
||||
}
|
||||
|
||||
final long startTime = System.currentTimeMillis();
|
||||
|
||||
@@ -25,7 +25,6 @@ import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.provider.Settings.Global;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.loader.app.LoaderManager;
|
||||
@@ -104,10 +103,6 @@ public class PowerUsageSummary extends PowerUsageBase implements
|
||||
|
||||
@Override
|
||||
public void onLoadFinished(Loader<BatteryInfo> loader, BatteryInfo batteryInfo) {
|
||||
if (batteryInfo == null) {
|
||||
Log.w(TAG, "mBatteryInfoLoaderCallbacks: batteryInfo = null");
|
||||
return;
|
||||
}
|
||||
mBatteryHeaderPreferenceController.updateHeaderPreference(batteryInfo);
|
||||
mBatteryHeaderPreferenceController.updateHeaderByBatteryTips(
|
||||
mBatteryTipPreferenceController.getCurrentBatteryTip(), batteryInfo);
|
||||
@@ -131,10 +126,6 @@ public class PowerUsageSummary extends PowerUsageBase implements
|
||||
@Override
|
||||
public void onLoadFinished(Loader<List<BatteryTip>> loader,
|
||||
List<BatteryTip> data) {
|
||||
if (mBatteryInfo == null) {
|
||||
Log.w(TAG, "mBatteryTipsCallbacks: batteryInfo = null");
|
||||
return;
|
||||
}
|
||||
mBatteryTipPreferenceController.updateBatteryTips(data);
|
||||
mBatteryHeaderPreferenceController.updateHeaderByBatteryTips(
|
||||
mBatteryTipPreferenceController.getCurrentBatteryTip(), mBatteryInfo);
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.android.settings.fuelgauge.batterytip;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.BatteryUsageStats;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
@@ -68,16 +67,11 @@ public class BatteryTipLoader extends AsyncLoaderCompat<List<BatteryTip>> {
|
||||
final BatteryInfo batteryInfo = mBatteryUtils.getBatteryInfo(TAG);
|
||||
final Context context = getContext();
|
||||
|
||||
tips.add(new EarlyWarningDetector(policy, context).detect());
|
||||
if (batteryInfo == null) {
|
||||
Log.w(TAG, "loadInBackground() batteryInfo = null");
|
||||
return tips;
|
||||
}
|
||||
|
||||
tips.add(new LowBatteryDetector(context, policy, batteryInfo).detect());
|
||||
tips.add(new HighUsageDetector(context, policy, mBatteryUsageStats, batteryInfo).detect());
|
||||
tips.add(new SmartBatteryDetector(
|
||||
context, policy, batteryInfo, context.getContentResolver()).detect());
|
||||
tips.add(new EarlyWarningDetector(policy, context).detect());
|
||||
tips.add(new BatteryDefenderDetector(batteryInfo).detect());
|
||||
Collections.sort(tips);
|
||||
return tips;
|
||||
|
||||
Reference in New Issue
Block a user