Snap for 8652434 from af87b62083
to tm-qpr1-release
Change-Id: I23e8ee3594c140bd73d0a21baf9e2abb68e07f1b
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
<style name="GlifTheme.DayNight" parent="GlifTheme" />
|
||||
<style name="GlifV2Theme.DayNight" parent="GlifV2Theme" />
|
||||
<style name="GlifV3Theme.DayNight" parent="GlifV3Theme" />
|
||||
<style name="GlifV4Theme.DayNight" parent="GlifV4Theme" />
|
||||
<style name="GlifV3Theme.DayNight.NoActionBar" parent="GlifV3Theme.NoActionBar" />
|
||||
<style name="GlifV2Theme.DayNight.Transparent" parent="GlifV2Theme.Transparent" />
|
||||
<style name="GlifV3Theme.DayNight.Transparent" parent="GlifV3Theme.Transparent" />
|
||||
|
@@ -133,6 +133,43 @@
|
||||
<item name="*android:lockPatternStyle">@style/LockPatternStyle</item>
|
||||
</style>
|
||||
|
||||
<style name="GlifV4Theme" parent="SudThemeGlifV4.DayNight">
|
||||
<!-- For all AndroidX Alert Dialogs -->
|
||||
<item name="alertDialogTheme">@style/GlifV2ThemeAlertDialog</item>
|
||||
<item name="android:windowBackground">?android:attr/colorBackground</item>
|
||||
<item name="*android:preferencePanelStyle">@*android:style/PreferencePanel.Dialog</item>
|
||||
<item name="fingerprint_layout_theme">@style/FingerprintLayoutTheme</item>
|
||||
<item name="face_layout_theme">@style/FaceLayoutTheme</item>
|
||||
<item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_material</item>
|
||||
<item name="side_margin">0dip</item>
|
||||
<item name="wifi_signal_color">@color/setup_wizard_wifi_color_dark</item>
|
||||
<item name="wifi_signal">@drawable/wifi_signal</item>
|
||||
<item name="wifi_friction">@drawable/wifi_friction</item>
|
||||
<item name="preferenceBackgroundColor">?android:attr/colorBackground</item>
|
||||
<item name="preferenceTheme">@style/PreferenceTheme.SetupWizard</item>
|
||||
|
||||
<!-- LockPatternView colors -->
|
||||
<item name="*android:lockPatternStyle">@style/LockPatternStyle</item>
|
||||
</style>
|
||||
|
||||
<style name="GlifV4Theme.Light" parent="SudThemeGlifV4.Light">
|
||||
<!-- For all AndroidX Alert Dialogs -->
|
||||
<item name="alertDialogTheme">@style/GlifV2ThemeAlertDialog.Light</item>
|
||||
<item name="android:windowBackground">?android:attr/colorBackground</item>
|
||||
<item name="*android:preferencePanelStyle">@*android:style/PreferencePanel.Dialog</item>
|
||||
<item name="fingerprint_layout_theme">@style/FingerprintLayoutTheme</item>
|
||||
<item name="face_layout_theme">@style/FaceLayoutTheme</item>
|
||||
<item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_material</item>
|
||||
<item name="side_margin">0dip</item>
|
||||
<item name="wifi_signal_color">@color/setup_wizard_wifi_color_light</item>
|
||||
<item name="wifi_signal">@drawable/wifi_signal</item>
|
||||
<item name="wifi_friction">@drawable/wifi_friction</item>
|
||||
<item name="preferenceBackgroundColor">?android:attr/colorBackground</item>
|
||||
<item name="preferenceTheme">@style/PreferenceTheme.SetupWizard</item>
|
||||
|
||||
<item name="*android:lockPatternStyle">@style/LockPatternStyle</item>
|
||||
</style>
|
||||
|
||||
<style name="GlifV3Theme.Light.NoActionBar" parent="GlifV3Theme.Light">
|
||||
<item name="android:windowActionBar">false</item>
|
||||
</style>
|
||||
@@ -238,6 +275,7 @@
|
||||
<style name="GlifTheme.DayNight" parent="GlifTheme.Light" />
|
||||
<style name="GlifV2Theme.DayNight" parent="GlifV2Theme.Light" />
|
||||
<style name="GlifV3Theme.DayNight" parent="GlifV3Theme.Light" />
|
||||
<style name="GlifV4Theme.DayNight" parent="GlifV4Theme.Light" />
|
||||
<style name="GlifV3Theme.DayNight.NoActionBar" parent="GlifV3Theme.Light.NoActionBar" />
|
||||
<style name="GlifV2Theme.DayNight.Transparent" parent="GlifV2Theme.Light.Transparent" />
|
||||
<style name="GlifV3Theme.DayNight.Transparent" parent="GlifV3Theme.Light.Transparent" />
|
||||
|
@@ -48,9 +48,9 @@ public class SetupWizardUtils {
|
||||
if (WizardManagerHelper.isAnySetupWizard(intent)) {
|
||||
if (ThemeHelper.isSetupWizardDayNightEnabled(context)) {
|
||||
switch (theme) {
|
||||
// TODO(b/233032365): Create glif v4 theme for this case.
|
||||
case ThemeHelper.THEME_GLIF_V4_LIGHT:
|
||||
case ThemeHelper.THEME_GLIF_V4:
|
||||
return R.style.GlifV4Theme_DayNight;
|
||||
case ThemeHelper.THEME_GLIF_V3_LIGHT:
|
||||
case ThemeHelper.THEME_GLIF_V3:
|
||||
return R.style.GlifV3Theme_DayNight;
|
||||
@@ -63,11 +63,12 @@ public class SetupWizardUtils {
|
||||
}
|
||||
} else {
|
||||
switch (theme) {
|
||||
// TODO(b/233032365): Create glif v4 theme for this case.
|
||||
case ThemeHelper.THEME_GLIF_V4_LIGHT:
|
||||
return R.style.GlifV4Theme_Light;
|
||||
case ThemeHelper.THEME_GLIF_V4:
|
||||
return R.style.GlifV4Theme;
|
||||
case ThemeHelper.THEME_GLIF_V3_LIGHT:
|
||||
return R.style.GlifV3Theme_Light;
|
||||
case ThemeHelper.THEME_GLIF_V4:
|
||||
case ThemeHelper.THEME_GLIF_V3:
|
||||
return R.style.GlifV3Theme;
|
||||
case ThemeHelper.THEME_GLIF_V2_LIGHT:
|
||||
@@ -82,9 +83,9 @@ public class SetupWizardUtils {
|
||||
}
|
||||
} else {
|
||||
switch (theme) {
|
||||
// TODO(b/233032365): Create glif v4 theme for this case.
|
||||
case ThemeHelper.THEME_GLIF_V4_LIGHT:
|
||||
case ThemeHelper.THEME_GLIF_V4:
|
||||
return R.style.GlifV4Theme;
|
||||
case ThemeHelper.THEME_GLIF_V3_LIGHT:
|
||||
case ThemeHelper.THEME_GLIF_V3:
|
||||
return R.style.GlifV3Theme;
|
||||
|
@@ -33,13 +33,9 @@ import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.permission.PermissionControllerManager;
|
||||
import android.provider.DeviceConfig;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Slog;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.lifecycle.LifecycleObserver;
|
||||
import androidx.lifecycle.OnLifecycleEvent;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
@@ -49,8 +45,7 @@ import com.google.common.annotations.VisibleForTesting;
|
||||
* A PreferenceController handling the logic for exempting hibernation of app
|
||||
*/
|
||||
public final class HibernationSwitchPreferenceController extends AppInfoPreferenceControllerBase
|
||||
implements LifecycleObserver, AppOpsManager.OnOpChangedListener,
|
||||
Preference.OnPreferenceChangeListener {
|
||||
implements Preference.OnPreferenceChangeListener {
|
||||
private static final String TAG = "HibernationSwitchPrefController";
|
||||
private String mPackageName;
|
||||
private final AppOpsManager mAppOpsManager;
|
||||
@@ -69,19 +64,6 @@ public final class HibernationSwitchPreferenceController extends AppInfoPreferen
|
||||
mPermissionControllerManager = context.getSystemService(PermissionControllerManager.class);
|
||||
}
|
||||
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
|
||||
public void onResume() {
|
||||
if (mIsPackageSet) {
|
||||
mAppOpsManager.startWatchingMode(
|
||||
OPSTR_AUTO_REVOKE_PERMISSIONS_IF_UNUSED, mPackageName, this);
|
||||
}
|
||||
}
|
||||
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
|
||||
public void onPause() {
|
||||
mAppOpsManager.stopWatchingMode(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return isHibernationEnabled() && mIsPackageSet ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
||||
@@ -148,14 +130,6 @@ public final class HibernationSwitchPreferenceController extends AppInfoPreferen
|
||||
return mode == MODE_DEFAULT ? mIsPackageExemptByDefault : mode != MODE_ALLOWED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOpChanged(String op, String packageName) {
|
||||
if (OPSTR_AUTO_REVOKE_PERMISSIONS_IF_UNUSED.equals(op)
|
||||
&& TextUtils.equals(mPackageName, packageName)) {
|
||||
updateState(mPreference);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object isChecked) {
|
||||
try {
|
||||
|
@@ -190,7 +190,8 @@ public class EnableMultiSimSidecar extends AsyncTaskSidecar<Void, Boolean> {
|
||||
Set<Integer> activeRemovableLogicalSlotIds = new ArraySet<>();
|
||||
for (UiccSlotInfo info : infos) {
|
||||
for (UiccPortInfo portInfo :info.getPorts()) {
|
||||
if (info != null && portInfo.isActive() && info.isRemovable()) {
|
||||
if (info != null && portInfo.isActive() && info.isRemovable()
|
||||
&& !info.getIsEuicc()) {
|
||||
activeRemovableLogicalSlotIds.add(portInfo.getLogicalSlotIndex());
|
||||
}
|
||||
}
|
||||
|
@@ -193,7 +193,7 @@ public class UiccSlotUtil {
|
||||
if (slotInfo == null) {
|
||||
return false;
|
||||
}
|
||||
return !slotInfo.isRemovable();
|
||||
return slotInfo.getIsEuicc();
|
||||
})
|
||||
.findFirst().orElse(-1);
|
||||
|
||||
@@ -249,6 +249,7 @@ public class UiccSlotUtil {
|
||||
if (slotId == INVALID_PHYSICAL_SLOT_ID) {
|
||||
for (int i = 0; i < slots.length; i++) {
|
||||
if (slots[i].isRemovable()
|
||||
&& !slots[i].getIsEuicc()
|
||||
&& !slots[i].getPorts().stream().findFirst().get().isActive()
|
||||
&& slots[i].getCardStateInfo() != UiccSlotInfo.CARD_STATE_INFO_ERROR
|
||||
&& slots[i].getCardStateInfo() != UiccSlotInfo.CARD_STATE_INFO_RESTRICTED) {
|
||||
|
@@ -592,6 +592,7 @@ public class ToggleSubscriptionDialogActivity extends SubscriptionActionDialogAc
|
||||
.anyMatch(
|
||||
slot -> slot != null
|
||||
&& slot.isRemovable()
|
||||
&& !slot.getIsEuicc()
|
||||
&& slot.getPorts().stream().anyMatch(
|
||||
port -> port.isActive())
|
||||
&& slot.getCardStateInfo()
|
||||
|
@@ -294,7 +294,7 @@ public class SimSlotChangeHandler {
|
||||
return null;
|
||||
}
|
||||
for (UiccSlotInfo slotInfo : slotInfos) {
|
||||
if (slotInfo != null && slotInfo.isRemovable()) {
|
||||
if (slotInfo != null && slotInfo.isRemovable() && !slotInfo.getIsEuicc()) {
|
||||
return slotInfo;
|
||||
}
|
||||
}
|
||||
|
@@ -92,6 +92,14 @@ public class UiccSlotUtilTest {
|
||||
|
||||
assertThat(testSlot).isEqualTo(0);
|
||||
}
|
||||
@Test
|
||||
public void getEsimSlotId_twoSimSlotsDeviceAndRemovableEsimIsSlot1_returnTheCorrectEsimSlot() {
|
||||
when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(
|
||||
twoSimSlotsDeviceActivePsimActiveRemovableEsim());
|
||||
int testSlot = UiccSlotUtil.getEsimSlotId(mContext);
|
||||
|
||||
assertThat(testSlot).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getEsimSlotId_twoSimSlotsDeviceAndEsimIsSlot1_returnTheCorrectEsimSlot() {
|
||||
@@ -729,6 +737,12 @@ public class UiccSlotUtilTest {
|
||||
createUiccSlotInfo(true, false, 1, true)};
|
||||
}
|
||||
|
||||
private UiccSlotInfo[] twoSimSlotsDeviceActivePsimActiveRemovableEsim() {
|
||||
return new UiccSlotInfo[]{
|
||||
createUiccSlotInfo(false, true, 0, true),
|
||||
createUiccSlotInfo(true, true, 1, true)};
|
||||
}
|
||||
|
||||
private UiccSlotInfo[] twoSimSlotsDeviceActiveEsimActivePsim() {
|
||||
return new UiccSlotInfo[]{
|
||||
createUiccSlotInfo(true, false, 0, true),
|
||||
|
Reference in New Issue
Block a user