Merge "Merge Android 12 QPR 3"
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings;
|
||||
|
||||
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
@@ -71,6 +73,8 @@ public class ActivityPicker extends AlertActivity implements
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
getWindow().addPrivateFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
|
||||
|
||||
final Intent intent = getIntent();
|
||||
|
||||
|
@@ -289,4 +289,14 @@ public class BiometricUtils {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the screen is going into a landscape mode and the angle is equal to
|
||||
* 90.
|
||||
* @param context Context that we use to get the display this context is associated with
|
||||
* @return True if the angle of the rotation is equal to 90.
|
||||
*/
|
||||
public static boolean isLandscape(@NonNull Context context) {
|
||||
return context.getDisplay().getRotation() == Surface.ROTATION_90;
|
||||
}
|
||||
}
|
||||
|
@@ -19,11 +19,13 @@ package com.android.settings.biometrics.fingerprint;
|
||||
import android.animation.Animator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.app.Dialog;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.drawable.Animatable2;
|
||||
import android.graphics.drawable.AnimatedVectorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -54,7 +56,9 @@ import com.android.settings.biometrics.BiometricEnrollSidecar;
|
||||
import com.android.settings.biometrics.BiometricUtils;
|
||||
import com.android.settings.biometrics.BiometricsEnrollEnrolling;
|
||||
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||
import com.android.settingslib.display.DisplayDensityUtils;
|
||||
|
||||
import com.airbnb.lottie.LottieAnimationView;
|
||||
import com.google.android.setupcompat.template.FooterBarMixin;
|
||||
import com.google.android.setupcompat.template.FooterButton;
|
||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||
@@ -126,10 +130,16 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
private boolean mIsSetupWizard;
|
||||
private AccessibilityManager mAccessibilityManager;
|
||||
private boolean mIsAccessibilityEnabled;
|
||||
private LottieAnimationView mIllustrationLottie;
|
||||
private boolean mHaveShownUdfpsTipLottie;
|
||||
private boolean mHaveShownUdfpsSideLottie;
|
||||
private boolean mShouldShowLottie;
|
||||
|
||||
private OrientationEventListener mOrientationEventListener;
|
||||
private int mPreviousRotation = 0;
|
||||
|
||||
private boolean mShowingNewUdfpsEnroll = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -163,6 +173,25 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
setHeaderText(R.string.security_settings_fingerprint_enroll_repeat_title);
|
||||
}
|
||||
|
||||
DisplayDensityUtils displayDensity =
|
||||
new DisplayDensityUtils(getApplicationContext());
|
||||
int currentDensityIndex = displayDensity.getCurrentIndex();
|
||||
final int currentDensity = displayDensity.getValues()[currentDensityIndex];
|
||||
final int defaultDensity = displayDensity.getDefaultDensity();
|
||||
mShouldShowLottie = defaultDensity == currentDensity;
|
||||
|
||||
mShowingNewUdfpsEnroll = getApplicationContext().getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_udfpsSupportsNewUi);
|
||||
// Only show the lottie if the current display density is the default density.
|
||||
// Otherwise, the lottie will overlap with the settings header text.
|
||||
boolean isLandscape = BiometricUtils.isReverseLandscape(getApplicationContext())
|
||||
|| BiometricUtils.isLandscape(getApplicationContext());
|
||||
|
||||
if (mShowingNewUdfpsEnroll) {
|
||||
updateOrientation((isLandscape
|
||||
? Configuration.ORIENTATION_LANDSCAPE : Configuration.ORIENTATION_PORTRAIT));
|
||||
}
|
||||
|
||||
mErrorText = findViewById(R.id.error_text);
|
||||
mProgressBar = findViewById(R.id.fingerprint_progress_bar);
|
||||
mVibrator = getSystemService(Vibrator.class);
|
||||
@@ -339,20 +368,53 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
|
||||
case STAGE_FINGERTIP:
|
||||
setHeaderText(R.string.security_settings_udfps_enroll_fingertip_title);
|
||||
if (isStageHalfCompleted()) {
|
||||
setDescriptionText(R.string.security_settings_fingerprint_enroll_repeat_title);
|
||||
if (mShowingNewUdfpsEnroll) {
|
||||
if (!mHaveShownUdfpsTipLottie && mIllustrationLottie != null) {
|
||||
mHaveShownUdfpsTipLottie = true;
|
||||
setDescriptionText("");
|
||||
mIllustrationLottie.setAnimation(R.raw.udfps_tip_hint_lottie);
|
||||
mIllustrationLottie.setVisibility(View.VISIBLE);
|
||||
mIllustrationLottie.playAnimation();
|
||||
mIllustrationLottie.setContentDescription(
|
||||
getString(R.string.security_settings_udfps_tip_fingerprint_help));
|
||||
}
|
||||
} else {
|
||||
setDescriptionText("");
|
||||
if (isStageHalfCompleted()) {
|
||||
setDescriptionText(
|
||||
R.string.security_settings_fingerprint_enroll_repeat_title);
|
||||
} else {
|
||||
setDescriptionText("");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case STAGE_EDGES:
|
||||
setHeaderText(R.string.security_settings_udfps_enroll_edge_title);
|
||||
if (isStageHalfCompleted()) {
|
||||
setDescriptionText(
|
||||
R.string.security_settings_fingerprint_enroll_repeat_message);
|
||||
if (mShowingNewUdfpsEnroll) {
|
||||
if (!mHaveShownUdfpsSideLottie && mIllustrationLottie != null) {
|
||||
mHaveShownUdfpsSideLottie = true;
|
||||
setDescriptionText("");
|
||||
mIllustrationLottie.setAnimation(R.raw.udfps_edge_hint_lottie);
|
||||
mIllustrationLottie.setVisibility(View.VISIBLE);
|
||||
mIllustrationLottie.playAnimation();
|
||||
mIllustrationLottie.setContentDescription(
|
||||
getString(R.string.security_settings_udfps_side_fingerprint_help));
|
||||
} else if (mIllustrationLottie == null) {
|
||||
if (isStageHalfCompleted()) {
|
||||
setDescriptionText(
|
||||
R.string.security_settings_fingerprint_enroll_repeat_message);
|
||||
} else {
|
||||
setDescriptionText(
|
||||
R.string.security_settings_udfps_enroll_edge_message);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setDescriptionText(R.string.security_settings_udfps_enroll_edge_message);
|
||||
if (isStageHalfCompleted()) {
|
||||
setDescriptionText(
|
||||
R.string.security_settings_fingerprint_enroll_repeat_message);
|
||||
} else {
|
||||
setDescriptionText(R.string.security_settings_udfps_enroll_edge_message);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -634,6 +696,45 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
return SettingsEnums.FINGERPRINT_ENROLLING;
|
||||
}
|
||||
|
||||
private void updateOrientation(int orientation) {
|
||||
switch(orientation) {
|
||||
case Configuration.ORIENTATION_LANDSCAPE: {
|
||||
mIllustrationLottie = null;
|
||||
break;
|
||||
}
|
||||
case Configuration.ORIENTATION_PORTRAIT: {
|
||||
if (mShouldShowLottie) {
|
||||
mIllustrationLottie = findViewById(R.id.illustration_lottie);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
Log.e(TAG, "Error unhandled configuration change");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(@NonNull Configuration newConfig) {
|
||||
if (!mShowingNewUdfpsEnroll) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch(newConfig.orientation) {
|
||||
case Configuration.ORIENTATION_LANDSCAPE: {
|
||||
updateOrientation(Configuration.ORIENTATION_LANDSCAPE);
|
||||
break;
|
||||
}
|
||||
case Configuration.ORIENTATION_PORTRAIT: {
|
||||
updateOrientation(Configuration.ORIENTATION_PORTRAIT);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
Log.e(TAG, "Error unhandled configuration change");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static class IconTouchDialog extends InstrumentedDialogFragment {
|
||||
|
||||
@Override
|
||||
|
@@ -36,9 +36,11 @@ import android.net.wifi.WifiManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.PowerManager;
|
||||
import android.os.UserManager;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.EventLog;
|
||||
import android.util.FeatureFlagUtils;
|
||||
import android.util.Log;
|
||||
import android.view.ContextMenu;
|
||||
@@ -206,6 +208,8 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
||||
* by the Test DPC tool in AFW mode.
|
||||
*/
|
||||
protected boolean mIsRestricted;
|
||||
@VisibleForTesting
|
||||
boolean mIsAdmin = true;
|
||||
|
||||
@VisibleForTesting
|
||||
AirplaneModeEnabler mAirplaneModeEnabler;
|
||||
@@ -287,6 +291,13 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
||||
addPreferences();
|
||||
|
||||
mIsRestricted = isUiRestricted();
|
||||
mIsAdmin = isAdminUser();
|
||||
}
|
||||
|
||||
private boolean isAdminUser() {
|
||||
final UserManager userManager = getSystemService(UserManager.class);
|
||||
if (userManager == null) return true;
|
||||
return userManager.isAdminUser();
|
||||
}
|
||||
|
||||
private void addPreferences() {
|
||||
@@ -551,7 +562,9 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
||||
}
|
||||
|
||||
if (mSelectedWifiEntry.canDisconnect()) {
|
||||
menu.add(Menu.NONE, MENU_ID_SHARE, 0 /* order */, R.string.share);
|
||||
if (mSelectedWifiEntry.canShare()) {
|
||||
addShareMenuIfSuitable(menu);
|
||||
}
|
||||
menu.add(Menu.NONE, MENU_ID_DISCONNECT, 1 /* order */,
|
||||
R.string.wifi_disconnect_button_text);
|
||||
}
|
||||
@@ -559,7 +572,7 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
||||
// "forget" for normal saved network. And "disconnect" for ephemeral network because it
|
||||
// could only be disconnected and be put in blocklists so it won't be used again.
|
||||
if (canForgetNetwork()) {
|
||||
menu.add(Menu.NONE, MENU_ID_FORGET, 0 /* order */, R.string.forget);
|
||||
addForgetMenuIfSuitable(menu);
|
||||
}
|
||||
|
||||
WifiConfiguration config = mSelectedWifiEntry.getWifiConfiguration();
|
||||
@@ -574,6 +587,23 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void addShareMenuIfSuitable(ContextMenu menu) {
|
||||
if (mIsAdmin) {
|
||||
menu.add(Menu.NONE, MENU_ID_SHARE, 0 /* order */, R.string.share);
|
||||
return;
|
||||
}
|
||||
Log.w(TAG, "Don't add the Wi-Fi share menu because the user is not an admin.");
|
||||
EventLog.writeEvent(0x534e4554, "206986392", -1 /* UID */, "User is not an admin");
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void addForgetMenuIfSuitable(ContextMenu menu) {
|
||||
if (mIsAdmin) {
|
||||
menu.add(Menu.NONE, MENU_ID_FORGET, 0 /* order */, R.string.forget);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canForgetNetwork() {
|
||||
return mSelectedWifiEntry.canForget() && !WifiUtils.isNetworkLockedDown(getActivity(),
|
||||
mSelectedWifiEntry.getWifiConfiguration());
|
||||
|
@@ -264,12 +264,15 @@ public class SoundSettings extends DashboardFragment implements OnActivityResult
|
||||
new BootSoundPreferenceController(context);
|
||||
final EmergencyTonePreferenceController emergencyTonePreferenceController =
|
||||
new EmergencyTonePreferenceController(context, fragment, lifecycle);
|
||||
final VibrateIconPreferenceController vibrateIconPreferenceController =
|
||||
new VibrateIconPreferenceController(context, fragment, lifecycle);
|
||||
|
||||
controllers.add(dialPadTonePreferenceController);
|
||||
controllers.add(screenLockSoundPreferenceController);
|
||||
controllers.add(chargingSoundPreferenceController);
|
||||
controllers.add(dockingSoundPreferenceController);
|
||||
controllers.add(touchSoundPreferenceController);
|
||||
controllers.add(vibrateIconPreferenceController);
|
||||
controllers.add(vibrateOnTouchPreferenceController);
|
||||
controllers.add(dockAudioMediaPreferenceController);
|
||||
controllers.add(bootSoundPreferenceController);
|
||||
@@ -281,6 +284,7 @@ public class SoundSettings extends DashboardFragment implements OnActivityResult
|
||||
chargingSoundPreferenceController,
|
||||
dockingSoundPreferenceController,
|
||||
touchSoundPreferenceController,
|
||||
vibrateIconPreferenceController,
|
||||
vibrateOnTouchPreferenceController,
|
||||
dockAudioMediaPreferenceController,
|
||||
bootSoundPreferenceController,
|
||||
|
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.notification;
|
||||
|
||||
import static com.android.settings.notification.SettingPref.TYPE_SECURE;
|
||||
|
||||
import android.content.Context;
|
||||
import android.provider.Settings.Secure;
|
||||
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
|
||||
public class VibrateIconPreferenceController extends SettingPrefController {
|
||||
|
||||
private static final String KEY_VIBRATE_ICON = "vibrate_icon";
|
||||
|
||||
public VibrateIconPreferenceController(Context context, SettingsPreferenceFragment parent,
|
||||
Lifecycle lifecycle) {
|
||||
super(context, parent, lifecycle);
|
||||
mPreference = new SettingPref(
|
||||
TYPE_SECURE, KEY_VIBRATE_ICON, Secure.STATUS_BAR_SHOW_VIBRATE_ICON, 0 /*default off*/);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -17,6 +17,7 @@
|
||||
package com.android.settings.password;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.DialogInterface;
|
||||
@@ -26,7 +27,6 @@ import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
@@ -414,6 +414,9 @@ public class AddAppNetworksFragment extends InstrumentedFragment implements
|
||||
}
|
||||
|
||||
private void updateSingleNetworkSignalIcon(int level) {
|
||||
if (level == WifiEntry.WIFI_LEVEL_UNREACHABLE) {
|
||||
return;
|
||||
}
|
||||
// TODO: Check level of the network to show signal icon.
|
||||
final Drawable wifiIcon = mActivity.getDrawable(
|
||||
Utils.getWifiIconResource(level)).mutate();
|
||||
|
Reference in New Issue
Block a user