Merge "Update settings for app hibernation" into sc-dev
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c464da0..6dfae4b 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1873,7 +1873,7 @@
<!-- Used in the settings screen to secure NFC [CHAR LIMIT=NONE] -->
<string name="nfc_secure_settings_title">Require device unlock for NFC</string>
<!-- Description of Secure NFC in the 1st level settings screen. [CHAR LIMIT=NONE] -->
- <string name="nfc_secure_toggle_summary" product="default">Allow NFC Payment and Transit use only when screen is unlocked</string>
+ <string name="nfc_secure_toggle_summary" product="default">Allow NFC use only when screen is unlocked</string>
<!-- Used to enter the Android Beam sharing preferences screen. This phrase is a trademark. [CHAR LIMIT=32] -->
<string name="android_beam_settings_title">Android Beam</string>
@@ -2847,6 +2847,10 @@
<string name="adaptive_sleep_contextual_slice_title">Turn on screen attention</string>
<!-- Description about the contextual adaptive sleep card [CHAR LIMIT=NONE]-->
<string name="adaptive_sleep_contextual_slice_summary">Keep screen on when looking at it</string>
+ <!-- auto_rotate settings screen, title about the required permission is missing [CHAR LIMIT=NONE]-->
+ <string name="auto_rotate_summary_no_permission">Camera access is required for Face Detection. Tap to manage permissions for Device Personalization Services</string>
+ <!-- auto_rotate settings screen, text for the camera permission button [CHAR LIMIT=NONE]-->
+ <string name="auto_rotate_manage_permission_button">Manage permissions</string>
<!-- Night display screen, setting option name to enable night display (renamed "Night Light" with title caps). [CHAR LIMIT=30] -->
<string name="night_display_title">Night Light</string>
diff --git a/res/xml/auto_rotate_settings.xml b/res/xml/auto_rotate_settings.xml
index a316b8f..7c46d29 100644
--- a/res/xml/auto_rotate_settings.xml
+++ b/res/xml/auto_rotate_settings.xml
@@ -20,11 +20,10 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/accelerometer_title" >
- <Preference
+ <com.android.settingslib.widget.BannerMessagePreference
android:key="face_rotate_permission"
android:title="@string/adaptive_sleep_title_no_permission"
- android:summary="@string/adaptive_sleep_summary_no_permission"
- android:icon="@drawable/ic_info_outline_24"
+ android:summary="@string/auto_rotate_summary_no_permission"
settings:controller="com.android.settings.display.SmartAutoRotatePermissionController" />
<SwitchPreference
diff --git a/src/com/android/settings/display/SmartAutoRotatePermissionController.java b/src/com/android/settings/display/SmartAutoRotatePermissionController.java
index 484db31..caa306d 100644
--- a/src/com/android/settings/display/SmartAutoRotatePermissionController.java
+++ b/src/com/android/settings/display/SmartAutoRotatePermissionController.java
@@ -22,11 +22,12 @@
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
-import android.text.TextUtils;
-import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
+import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
+import com.android.settingslib.widget.BannerMessagePreference;
/**
* The controller of camera based rotate permission warning preference. The preference appears when
@@ -45,19 +46,22 @@
}
@Override
+ public void displayPreference(PreferenceScreen screen) {
+ super.displayPreference(screen);
+ final BannerMessagePreference preference =
+ (BannerMessagePreference) screen.findPreference(getPreferenceKey());
+ preference
+ .setPositiveButtonText(R.string.auto_rotate_manage_permission_button)
+ .setPositiveButtonOnClickListener(v -> {
+ mContext.startActivity(mIntent);
+ });
+ }
+
+ @Override
@AvailabilityStatus
public int getAvailabilityStatus() {
return isRotationResolverServiceAvailable(mContext) && !hasSufficientPermission(mContext)
? AVAILABLE_UNSEARCHABLE
: UNSUPPORTED_ON_DEVICE;
}
-
- @Override
- public boolean handlePreferenceTreeClick(Preference preference) {
- if (TextUtils.equals(getPreferenceKey(), preference.getKey())) {
- mContext.startActivity(mIntent);
- return true;
- }
- return super.handlePreferenceTreeClick(preference);
- }
}