Snap for 7989966 from d4b1048dbf to sc-v2-release

Change-Id: I8173251bdd94b26fbd81d49a49674d8318331168
This commit is contained in:
Android Build Coastguard Worker
2021-12-11 02:07:48 +00:00
16 changed files with 85 additions and 12511 deletions

View File

@@ -151,6 +151,7 @@
android:taskAffinity="" android:taskAffinity=""
android:launchMode="singleTask" android:launchMode="singleTask"
android:exported="true" android:exported="true"
android:enabled="false"
android:configChanges="orientation|keyboard|keyboardHidden|screenSize|screenLayout" android:configChanges="orientation|keyboard|keyboardHidden|screenSize|screenLayout"
android:permission="android.permission.LAUNCH_MULTI_PANE_SETTINGS_DEEP_LINK"> android:permission="android.permission.LAUNCH_MULTI_PANE_SETTINGS_DEEP_LINK">
<intent-filter> <intent-filter>
@@ -312,6 +313,7 @@
<receiver android:name=".search.SearchStateReceiver" <receiver android:name=".search.SearchStateReceiver"
android:exported="true" android:exported="true"
android:enabled="false"
android:permission="android.permission.READ_SEARCH_INDEXABLES"> android:permission="android.permission.READ_SEARCH_INDEXABLES">
<intent-filter> <intent-filter>
<action android:name="com.android.settings.SEARCH_START"/> <action android:name="com.android.settings.SEARCH_START"/>

View File

@@ -26,6 +26,7 @@
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<LinearLayout <LinearLayout
android:id="@+id/font_size_preview_text_group"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingTop="16dp" android:paddingTop="16dp"

View File

@@ -75,12 +75,6 @@
android:contentDescription="@string/font_size_make_larger_desc" android:contentDescription="@string/font_size_make_larger_desc"
style="@style/screen_size_imageview_style"/> style="@style/screen_size_imageview_style"/>
</LinearLayout> </LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/font_size_summary"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>

View File

@@ -74,12 +74,6 @@
android:contentDescription="@string/screen_zoom_make_larger_desc" android:contentDescription="@string/screen_zoom_make_larger_desc"
style="@style/screen_size_imageview_style"/> style="@style/screen_size_imageview_style"/>
</LinearLayout> </LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/screen_zoom_summary"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>

File diff suppressed because one or more lines are too long

View File

@@ -19,4 +19,6 @@
<!-- Dashboard number of columns --> <!-- Dashboard number of columns -->
<integer name="dashboard_num_columns">2</integer> <integer name="dashboard_num_columns">2</integer>
<!-- Whether to support large screen -->
<bool name="config_supported_large_screen">true</bool>
</resources> </resources>

View File

@@ -63,6 +63,9 @@
<dimen name="confirm_credentials_side_margin">0dp</dimen> <dimen name="confirm_credentials_side_margin">0dp</dimen>
<dimen name="confirm_credentials_top_margin">64dp</dimen> <dimen name="confirm_credentials_top_margin">64dp</dimen>
<!-- padding for font size preview in large screen -->
<dimen name="font_size_preview_padding_start">32dp</dimen>
<!-- Padding for screen pinning --> <!-- Padding for screen pinning -->
<dimen name="screen_pinning_padding_start">40dp</dimen> <dimen name="screen_pinning_padding_start">40dp</dimen>
<dimen name="screen_pinning_padding_end">40dp</dimen> <dimen name="screen_pinning_padding_end">40dp</dimen>

View File

@@ -532,6 +532,9 @@
<!-- Whether suw to support two panes --> <!-- Whether suw to support two panes -->
<bool name="config_suw_supported_two_panes">false</bool> <bool name="config_suw_supported_two_panes">false</bool>
<!-- Whether to support large screen -->
<bool name="config_supported_large_screen">false</bool>
<!-- Display settings screen, Color mode options. Must be the same length and order as <!-- Display settings screen, Color mode options. Must be the same length and order as
config_color_mode_options_values below. Only the values that also appear in config_color_mode_options_values below. Only the values that also appear in
frameworks/base/core/res/res/values/config.xml's config_availableColorModes are shown. --> frameworks/base/core/res/res/values/config.xml's config_availableColorModes are shown. -->

View File

@@ -871,11 +871,9 @@
<!-- Dialog title shown when the user removes an enrollment [CHAR LIMIT=35] --> <!-- Dialog title shown when the user removes an enrollment [CHAR LIMIT=35] -->
<string name="security_settings_face_settings_remove_dialog_title">Delete face model?</string> <string name="security_settings_face_settings_remove_dialog_title">Delete face model?</string>
<!-- Dialog contents shown when the user removes an enrollment [CHAR LIMIT=NONE] --> <!-- Dialog contents shown when the user removes an enrollment [CHAR LIMIT=NONE] -->
<string name="security_settings_face_settings_remove_dialog_details">Your face model will be permanently and securely deleted. After deletion, you will need your PIN, pattern, or password to unlock your phone or for authentication in apps.</string> <string name="security_settings_face_settings_remove_dialog_details">Your face model will be permanently and securely deleted.\n\nAfter deletion, you will need your PIN, pattern, or password to unlock your phone or for authentication in apps.</string>
<!-- Dialog title shown when the user chooses to delete an existing enrolled face model. [CHAR LIMIT=35] --> <!-- Dialog contents shown when the user removes an enrollment when configured as a convenience [CHAR LIMIT=NONE] -->
<string name="security_settings_face_settings_remove_model_dialog_title">Delete face model?</string> <string name="security_settings_face_settings_remove_dialog_details_convenience">Your face model will be permanently and securely deleted.\n\nAfter deletion, you will need your PIN, pattern, or password to unlock your phone.</string>
<!-- Dialog contents shown when the user chooses to delete an existing enrolled face model. [CHAR LIMIT=NONE] -->
<string name="security_settings_face_settings_remove_model_dialog_details">Your face model will be permanently and securely deleted.\n\nAfter deletion, you will need your fingerprint, PIN, pattern, or password to unlock your phone or for authentication in apps.</string>
<!-- Subtitle shown for contextual setting face enrollment [CHAR LIMIT=NONE] --> <!-- Subtitle shown for contextual setting face enrollment [CHAR LIMIT=NONE] -->
<string name="security_settings_face_settings_context_subtitle">Use Face Unlock to unlock your phone</string> <string name="security_settings_face_settings_context_subtitle">Use Face Unlock to unlock your phone</string>

View File

@@ -120,8 +120,8 @@ public class AccessibilityScreenSizeForSetupWizardActivity extends InstrumentedA
: R.string.screen_zoom_title); : R.string.screen_zoom_title);
((TextView) findViewById(R.id.sud_layout_subtitle)).setText( ((TextView) findViewById(R.id.sud_layout_subtitle)).setText(
getFragmentType(getIntent()) == FragmentType.FONT_SIZE getFragmentType(getIntent()) == FragmentType.FONT_SIZE
? R.string.short_summary_font_size ? R.string.font_size_summary
: R.string.screen_zoom_short_summary); : R.string.screen_zoom_summary);
} }
private boolean isSuwSupportedTwoPanes() { private boolean isSuwSupportedTwoPanes() {

View File

@@ -22,6 +22,9 @@ import android.app.admin.DevicePolicyManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentSender; import android.content.IntentSender;
import android.hardware.biometrics.SensorProperties;
import android.hardware.face.FaceManager;
import android.hardware.face.FaceSensorPropertiesInternal;
import android.os.storage.StorageManager; import android.os.storage.StorageManager;
import android.util.Log; import android.util.Log;
import android.view.Surface; import android.view.Surface;
@@ -273,4 +276,17 @@ public class BiometricUtils {
public static boolean isReverseLandscape(@NonNull Context context) { public static boolean isReverseLandscape(@NonNull Context context) {
return context.getDisplay().getRotation() == Surface.ROTATION_270; return context.getDisplay().getRotation() == Surface.ROTATION_270;
} }
/**
* @param faceManager
* @return True if at least one sensor is set as a convenience.
*/
public static boolean isConvenience(@NonNull FaceManager faceManager) {
for (FaceSensorPropertiesInternal props : faceManager.getSensorPropertiesInternal()) {
if (props.sensorStrength == SensorProperties.STRENGTH_CONVENIENCE) {
return true;
}
}
return false;
}
} }

View File

@@ -33,6 +33,7 @@ import androidx.preference.Preference;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.SettingsActivity; import com.android.settings.SettingsActivity;
import com.android.settings.biometrics.BiometricUtils;
import com.android.settings.core.BasePreferenceController; import com.android.settings.core.BasePreferenceController;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment; import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
import com.android.settings.overlay.FeatureFactory; import com.android.settings.overlay.FeatureFactory;
@@ -56,6 +57,7 @@ public class FaceSettingsRemoveButtonPreferenceController extends BasePreference
public static class ConfirmRemoveDialog extends InstrumentedDialogFragment { public static class ConfirmRemoveDialog extends InstrumentedDialogFragment {
private boolean mIsConvenience;
private DialogInterface.OnClickListener mOnClickListener; private DialogInterface.OnClickListener mOnClickListener;
@Override @Override
@@ -68,7 +70,9 @@ public class FaceSettingsRemoveButtonPreferenceController extends BasePreference
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.security_settings_face_settings_remove_dialog_title) builder.setTitle(R.string.security_settings_face_settings_remove_dialog_title)
.setMessage(R.string.security_settings_face_settings_remove_dialog_details) .setMessage(mIsConvenience
? R.string.security_settings_face_settings_remove_dialog_details_convenience
: R.string.security_settings_face_settings_remove_dialog_details)
.setPositiveButton(R.string.delete, mOnClickListener) .setPositiveButton(R.string.delete, mOnClickListener)
.setNegativeButton(R.string.cancel, mOnClickListener); .setNegativeButton(R.string.cancel, mOnClickListener);
AlertDialog dialog = builder.create(); AlertDialog dialog = builder.create();
@@ -76,6 +80,10 @@ public class FaceSettingsRemoveButtonPreferenceController extends BasePreference
return dialog; return dialog;
} }
public void setIsConvenience(boolean isConvenience) {
mIsConvenience = isConvenience;
}
public void setOnClickListener(DialogInterface.OnClickListener listener) { public void setOnClickListener(DialogInterface.OnClickListener listener) {
mOnClickListener = listener; mOnClickListener = listener;
} }
@@ -197,6 +205,7 @@ public class FaceSettingsRemoveButtonPreferenceController extends BasePreference
mRemoving = true; mRemoving = true;
ConfirmRemoveDialog dialog = new ConfirmRemoveDialog(); ConfirmRemoveDialog dialog = new ConfirmRemoveDialog();
dialog.setOnClickListener(mOnClickListener); dialog.setOnClickListener(mOnClickListener);
dialog.setIsConvenience(BiometricUtils.isConvenience(mFaceManager));
dialog.show(mActivity.getSupportFragmentManager(), ConfirmRemoveDialog.class.getName()); dialog.show(mActivity.getSupportFragmentManager(), ConfirmRemoveDialog.class.getName());
} }
} }

View File

@@ -17,6 +17,13 @@
package com.android.settings.display; package com.android.settings.display;
import android.app.settings.SettingsEnums; import android.app.settings.SettingsEnums;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.viewpager.widget.ViewPager;
import com.android.settings.R; import com.android.settings.R;
@@ -33,6 +40,23 @@ public class FontSizePreferenceFragmentForSetupWizard
return SettingsEnums.SUW_ACCESSIBILITY_FONT_SIZE; return SettingsEnums.SUW_ACCESSIBILITY_FONT_SIZE;
} }
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View root = super.onCreateView(inflater, container, savedInstanceState);
if (getResources().getBoolean(R.bool.config_supported_large_screen)) {
final ViewPager viewPager = root.findViewById(R.id.preview_pager);
final View view = (View) viewPager.getAdapter().instantiateItem(viewPager,
viewPager.getCurrentItem());
final LinearLayout layout = view.findViewById(R.id.font_size_preview_text_group);
final int paddingStart = getResources().getDimensionPixelSize(
R.dimen.font_size_preview_padding_start);
layout.setPaddingRelative(paddingStart, layout.getPaddingTop(),
layout.getPaddingEnd(), layout.getPaddingBottom());
}
return root;
}
@Override @Override
public void onStop() { public void onStop() {
// Log the final choice in value if it's different from the previous value. // Log the final choice in value if it's different from the previous value.

View File

@@ -311,7 +311,7 @@ public class SettingsHomepageActivity extends FragmentActivity implements
} }
private void launchDeepLinkIntentToRight() { private void launchDeepLinkIntentToRight() {
if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(this)) { if (!mIsEmbeddingActivityEnabled) {
return; return;
} }

View File

@@ -19,12 +19,14 @@ package com.android.settings.homepage;
import static com.android.settings.search.actionbar.SearchMenuController.NEED_SEARCH_ICON_IN_ACTION_BAR; import static com.android.settings.search.actionbar.SearchMenuController.NEED_SEARCH_ICON_IN_ACTION_BAR;
import static com.android.settingslib.search.SearchIndexable.MOBILE; import static com.android.settingslib.search.SearchIndexable.MOBILE;
import android.app.ActivityManager;
import android.app.settings.SettingsEnums; import android.app.settings.SettingsEnums;
import android.content.Context; import android.content.Context;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.preference.Preference; import androidx.preference.Preference;
@@ -53,6 +55,7 @@ public class TopLevelSettings extends DashboardFragment implements
private static final String SAVED_HIGHLIGHT_MIXIN = "highlight_mixin"; private static final String SAVED_HIGHLIGHT_MIXIN = "highlight_mixin";
private static final String PREF_KEY_SUPPORT = "top_level_support"; private static final String PREF_KEY_SUPPORT = "top_level_support";
private boolean mIsEmbeddingActivityEnabled;
private TopLevelHighlightMixin mHighlightMixin; private TopLevelHighlightMixin mHighlightMixin;
private boolean mFirstStarted = true; private boolean mFirstStarted = true;
@@ -122,7 +125,9 @@ public class TopLevelSettings extends DashboardFragment implements
@Override @Override
public void onCreate(Bundle icicle) { public void onCreate(Bundle icicle) {
super.onCreate(icicle); super.onCreate(icicle);
if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(getContext())) { mIsEmbeddingActivityEnabled =
ActivityEmbeddingUtils.isEmbeddingActivityEnabled(getContext());
if (!mIsEmbeddingActivityEnabled) {
return; return;
} }
@@ -138,15 +143,23 @@ public class TopLevelSettings extends DashboardFragment implements
public void onStart() { public void onStart() {
if (mFirstStarted) { if (mFirstStarted) {
mFirstStarted = false; mFirstStarted = false;
} else if (!ActivityEmbeddingUtils.isTwoPaneResolution(getActivity())) { } else if (mIsEmbeddingActivityEnabled && isOnlyOneActivityInTask()
&& !ActivityEmbeddingUtils.isTwoPaneResolution(getActivity())) {
// Set default highlight menu key for 1-pane homepage since it will show the placeholder // Set default highlight menu key for 1-pane homepage since it will show the placeholder
// page once changing back to 2-pane. // page once changing back to 2-pane.
Log.i(TAG, "Set default menu key");
setHighlightMenuKey(getString(SettingsHomepageActivity.DEFAULT_HIGHLIGHT_MENU_KEY), setHighlightMenuKey(getString(SettingsHomepageActivity.DEFAULT_HIGHLIGHT_MENU_KEY),
/* scrollNeeded= */ false); /* scrollNeeded= */ false);
} }
super.onStart(); super.onStart();
} }
private boolean isOnlyOneActivityInTask() {
final ActivityManager.RunningTaskInfo taskInfo = getSystemService(ActivityManager.class)
.getRunningTasks(1).get(0);
return taskInfo.numActivities == 1;
}
@Override @Override
public void onSaveInstanceState(Bundle outState) { public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
@@ -225,8 +238,7 @@ public class TopLevelSettings extends DashboardFragment implements
@Override @Override
protected RecyclerView.Adapter onCreateAdapter(PreferenceScreen preferenceScreen) { protected RecyclerView.Adapter onCreateAdapter(PreferenceScreen preferenceScreen) {
if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(getContext()) if (!mIsEmbeddingActivityEnabled || !(getActivity() instanceof SettingsHomepageActivity)) {
|| !(getActivity() instanceof SettingsHomepageActivity)) {
return super.onCreateAdapter(preferenceScreen); return super.onCreateAdapter(preferenceScreen);
} }
return mHighlightMixin.onCreateAdapter(this, preferenceScreen); return mHighlightMixin.onCreateAdapter(this, preferenceScreen);

View File

@@ -59,6 +59,7 @@ public abstract class ZenModeRuleSettingsBase extends ZenModeSettingsBase {
@Override @Override
public void onCreate(Bundle icicle) { public void onCreate(Bundle icicle) {
super.onCreate(icicle);
mContext = getActivity(); mContext = getActivity();
final Intent intent = getActivity().getIntent(); final Intent intent = getActivity().getIntent();
@@ -81,7 +82,6 @@ public abstract class ZenModeRuleSettingsBase extends ZenModeSettingsBase {
return; return;
} }
super.onCreate(icicle);
mCustomBehaviorPreference = getPreferenceScreen().findPreference(CUSTOM_BEHAVIOR_KEY); mCustomBehaviorPreference = getPreferenceScreen().findPreference(CUSTOM_BEHAVIOR_KEY);
mCustomBehaviorPreference.setOnPreferenceClickListener( mCustomBehaviorPreference.setOnPreferenceClickListener(
new Preference.OnPreferenceClickListener() { new Preference.OnPreferenceClickListener() {