Snap for 8656595 from 7b75a759ac to tm-qpr1-release
Change-Id: Id324d111d6861e8c6bfa14d353103479af437c0e
This commit is contained in:
@@ -51,7 +51,7 @@ public class DefaultRingtonePreference extends RingtonePreference {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String mimeType = getContext().getContentResolver().getType(ringtoneUri);
|
String mimeType = mUserContext.getContentResolver().getType(ringtoneUri);
|
||||||
if (mimeType == null) {
|
if (mimeType == null) {
|
||||||
Log.e(TAG, "onSaveRingtone for URI:" + ringtoneUri
|
Log.e(TAG, "onSaveRingtone for URI:" + ringtoneUri
|
||||||
+ " ignored: failure to find mimeType (no access from this context?)");
|
+ " ignored: failure to find mimeType (no access from this context?)");
|
||||||
|
|||||||
@@ -466,6 +466,15 @@ public class SettingsActivity extends SettingsBaseActivity
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the activity's launch mode is "singleInstance", it can't be embedded in Settings since
|
||||||
|
// it will be created in a new task.
|
||||||
|
ActivityInfo info = intent.resolveActivityInfo(getPackageManager(),
|
||||||
|
PackageManager.MATCH_DEFAULT_ONLY);
|
||||||
|
if (info.launchMode == ActivityInfo.LAUNCH_SINGLE_INSTANCE) {
|
||||||
|
Log.w(LOG_TAG, "launchMode: singleInstance");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (intent.getBooleanExtra(EXTRA_IS_FROM_SLICE, false)) {
|
if (intent.getBooleanExtra(EXTRA_IS_FROM_SLICE, false)) {
|
||||||
// Slice deep link starts the Intent using SubSettingLauncher. Returns true to show
|
// Slice deep link starts the Intent using SubSettingLauncher. Returns true to show
|
||||||
// 2-pane deep link.
|
// 2-pane deep link.
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ import androidx.loader.content.Loader;
|
|||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.Preference.OnPreferenceChangeListener;
|
import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||||
import androidx.preference.PreferenceCategory;
|
import androidx.preference.PreferenceCategory;
|
||||||
|
import androidx.recyclerview.widget.DefaultItemAnimator;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.applications.AppInfoBase;
|
import com.android.settings.applications.AppInfoBase;
|
||||||
@@ -105,6 +107,7 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
|
|||||||
private Context mContext;
|
private Context mContext;
|
||||||
private ArrayList<Long> mCycles;
|
private ArrayList<Long> mCycles;
|
||||||
private long mSelectedCycle;
|
private long mSelectedCycle;
|
||||||
|
private boolean mIsLoading;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
@@ -226,6 +229,16 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
|
|||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
// No animations will occur before:
|
||||||
|
// - LOADER_APP_USAGE_DATA initially updates the cycle
|
||||||
|
// - updatePrefs() initially updates the preference visibility
|
||||||
|
// This is mainly for the cycle spinner, because when the page is entered from the
|
||||||
|
// AppInfoDashboardFragment, there is no way to know whether the cycle data is available
|
||||||
|
// before finished the async loading.
|
||||||
|
// The animator will be set back if any page updates happens after loading, in
|
||||||
|
// setBackPreferenceListAnimatorIfLoaded().
|
||||||
|
mIsLoading = true;
|
||||||
|
getListView().setItemAnimator(null);
|
||||||
if (mDataSaverBackend != null) {
|
if (mDataSaverBackend != null) {
|
||||||
mDataSaverBackend.addListener(this);
|
mDataSaverBackend.addListener(this);
|
||||||
}
|
}
|
||||||
@@ -297,7 +310,25 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets back the preference list's animator if the loading is finished.
|
||||||
|
*
|
||||||
|
* The preference list's animator was temporarily removed before loading in onResume().
|
||||||
|
* When need to update the preference visibility in this page after the loading, adding the
|
||||||
|
* animator back to keeping the usual animations.
|
||||||
|
*/
|
||||||
|
private void setBackPreferenceListAnimatorIfLoaded() {
|
||||||
|
if (mIsLoading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
RecyclerView recyclerView = getListView();
|
||||||
|
if (recyclerView.getItemAnimator() == null) {
|
||||||
|
recyclerView.setItemAnimator(new DefaultItemAnimator());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updatePrefs(boolean restrictBackground, boolean unrestrictData) {
|
private void updatePrefs(boolean restrictBackground, boolean unrestrictData) {
|
||||||
|
setBackPreferenceListAnimatorIfLoaded();
|
||||||
final EnforcedAdmin admin = RestrictedLockUtilsInternal.checkIfMeteredDataRestricted(
|
final EnforcedAdmin admin = RestrictedLockUtilsInternal.checkIfMeteredDataRestricted(
|
||||||
mContext, mPackageName, UserHandle.getUserId(mAppItem.key));
|
mContext, mPackageName, UserHandle.getUserId(mAppItem.key));
|
||||||
if (mRestrictBackground != null) {
|
if (mRestrictBackground != null) {
|
||||||
@@ -448,6 +479,7 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
|
|||||||
} else {
|
} else {
|
||||||
bindData(0 /* position */);
|
bindData(0 /* position */);
|
||||||
}
|
}
|
||||||
|
mIsLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import android.widget.ProgressBar;
|
|||||||
|
|
||||||
import androidx.preference.PreferenceViewHolder;
|
import androidx.preference.PreferenceViewHolder;
|
||||||
|
|
||||||
|
import com.android.settings.R;
|
||||||
import com.android.settingslib.AppItem;
|
import com.android.settingslib.AppItem;
|
||||||
import com.android.settingslib.net.UidDetail;
|
import com.android.settingslib.net.UidDetail;
|
||||||
import com.android.settingslib.net.UidDetailProvider;
|
import com.android.settingslib.net.UidDetailProvider;
|
||||||
@@ -49,6 +50,9 @@ public class AppDataUsagePreference extends AppPreference {
|
|||||||
if (mDetail != null) {
|
if (mDetail != null) {
|
||||||
setAppInfo();
|
setAppInfo();
|
||||||
} else {
|
} else {
|
||||||
|
// Set a placeholder title before starting to fetch real title, this is necessary
|
||||||
|
// to avoid preference height change.
|
||||||
|
setTitle(R.string.summary_placeholder);
|
||||||
ThreadUtils.postOnBackgroundThread(() -> {
|
ThreadUtils.postOnBackgroundThread(() -> {
|
||||||
mDetail = provider.getUidDetail(mItem.key, true /* blocking */);
|
mDetail = provider.getUidDetail(mItem.key, true /* blocking */);
|
||||||
ThreadUtils.postOnMainThread(() -> setAppInfo());
|
ThreadUtils.postOnMainThread(() -> setAppInfo());
|
||||||
|
|||||||
@@ -190,8 +190,7 @@ public class EnableMultiSimSidecar extends AsyncTaskSidecar<Void, Boolean> {
|
|||||||
Set<Integer> activeRemovableLogicalSlotIds = new ArraySet<>();
|
Set<Integer> activeRemovableLogicalSlotIds = new ArraySet<>();
|
||||||
for (UiccSlotInfo info : infos) {
|
for (UiccSlotInfo info : infos) {
|
||||||
for (UiccPortInfo portInfo :info.getPorts()) {
|
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());
|
activeRemovableLogicalSlotIds.add(portInfo.getLogicalSlotIndex());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -249,7 +249,6 @@ public class UiccSlotUtil {
|
|||||||
if (slotId == INVALID_PHYSICAL_SLOT_ID) {
|
if (slotId == INVALID_PHYSICAL_SLOT_ID) {
|
||||||
for (int i = 0; i < slots.length; i++) {
|
for (int i = 0; i < slots.length; i++) {
|
||||||
if (slots[i].isRemovable()
|
if (slots[i].isRemovable()
|
||||||
&& !slots[i].getIsEuicc()
|
|
||||||
&& !slots[i].getPorts().stream().findFirst().get().isActive()
|
&& !slots[i].getPorts().stream().findFirst().get().isActive()
|
||||||
&& slots[i].getCardStateInfo() != UiccSlotInfo.CARD_STATE_INFO_ERROR
|
&& slots[i].getCardStateInfo() != UiccSlotInfo.CARD_STATE_INFO_ERROR
|
||||||
&& slots[i].getCardStateInfo() != UiccSlotInfo.CARD_STATE_INFO_RESTRICTED) {
|
&& slots[i].getCardStateInfo() != UiccSlotInfo.CARD_STATE_INFO_RESTRICTED) {
|
||||||
|
|||||||
@@ -592,7 +592,6 @@ public class ToggleSubscriptionDialogActivity extends SubscriptionActionDialogAc
|
|||||||
.anyMatch(
|
.anyMatch(
|
||||||
slot -> slot != null
|
slot -> slot != null
|
||||||
&& slot.isRemovable()
|
&& slot.isRemovable()
|
||||||
&& !slot.getIsEuicc()
|
|
||||||
&& slot.getPorts().stream().anyMatch(
|
&& slot.getPorts().stream().anyMatch(
|
||||||
port -> port.isActive())
|
port -> port.isActive())
|
||||||
&& slot.getCardStateInfo()
|
&& slot.getCardStateInfo()
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ public class SimSlotChangeHandler {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
for (UiccSlotInfo slotInfo : slotInfos) {
|
for (UiccSlotInfo slotInfo : slotInfos) {
|
||||||
if (slotInfo != null && slotInfo.isRemovable() && !slotInfo.getIsEuicc()) {
|
if (slotInfo != null && slotInfo.isRemovable()) {
|
||||||
return slotInfo;
|
return slotInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import androidx.fragment.app.FragmentActivity;
|
|||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.android.settings.applications.AppInfoBase;
|
import com.android.settings.applications.AppInfoBase;
|
||||||
import com.android.settings.testutils.FakeFeatureFactory;
|
import com.android.settings.testutils.FakeFeatureFactory;
|
||||||
@@ -240,6 +241,7 @@ public class AppDataUsageTest {
|
|||||||
ReflectionHelpers.setField(mFragment, "mUnrestrictedData", unrestrictedDataPref);
|
ReflectionHelpers.setField(mFragment, "mUnrestrictedData", unrestrictedDataPref);
|
||||||
ReflectionHelpers.setField(mFragment, "mDataSaverBackend", dataSaverBackend);
|
ReflectionHelpers.setField(mFragment, "mDataSaverBackend", dataSaverBackend);
|
||||||
ReflectionHelpers.setField(mFragment.services, "mPolicyManager", networkPolicyManager);
|
ReflectionHelpers.setField(mFragment.services, "mPolicyManager", networkPolicyManager);
|
||||||
|
when(mFragment.getListView()).thenReturn(mock(RecyclerView.class));
|
||||||
|
|
||||||
ShadowRestrictedLockUtilsInternal.setRestricted(true);
|
ShadowRestrictedLockUtilsInternal.setRestricted(true);
|
||||||
doReturn(NetworkPolicyManager.POLICY_NONE).when(networkPolicyManager)
|
doReturn(NetworkPolicyManager.POLICY_NONE).when(networkPolicyManager)
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ public class DefaultRingtonePreferenceTest {
|
|||||||
when(mDefaultRingtonePreference.getRingtoneType())
|
when(mDefaultRingtonePreference.getRingtoneType())
|
||||||
.thenReturn(RingtoneManager.TYPE_RINGTONE);
|
.thenReturn(RingtoneManager.TYPE_RINGTONE);
|
||||||
mDefaultRingtonePreference.setUserId(1);
|
mDefaultRingtonePreference.setUserId(1);
|
||||||
|
mDefaultRingtonePreference.mUserContext = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user