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;
|
||||
}
|
||||
|
||||
String mimeType = getContext().getContentResolver().getType(ringtoneUri);
|
||||
String mimeType = mUserContext.getContentResolver().getType(ringtoneUri);
|
||||
if (mimeType == null) {
|
||||
Log.e(TAG, "onSaveRingtone for URI:" + ringtoneUri
|
||||
+ " ignored: failure to find mimeType (no access from this context?)");
|
||||
|
||||
@@ -466,6 +466,15 @@ public class SettingsActivity extends SettingsBaseActivity
|
||||
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)) {
|
||||
// Slice deep link starts the Intent using SubSettingLauncher. Returns true to show
|
||||
// 2-pane deep link.
|
||||
|
||||
@@ -40,6 +40,8 @@ import androidx.loader.content.Loader;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||
import androidx.preference.PreferenceCategory;
|
||||
import androidx.recyclerview.widget.DefaultItemAnimator;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.applications.AppInfoBase;
|
||||
@@ -105,6 +107,7 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
|
||||
private Context mContext;
|
||||
private ArrayList<Long> mCycles;
|
||||
private long mSelectedCycle;
|
||||
private boolean mIsLoading;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
@@ -226,6 +229,16 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
|
||||
@Override
|
||||
public void 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) {
|
||||
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) {
|
||||
setBackPreferenceListAnimatorIfLoaded();
|
||||
final EnforcedAdmin admin = RestrictedLockUtilsInternal.checkIfMeteredDataRestricted(
|
||||
mContext, mPackageName, UserHandle.getUserId(mAppItem.key));
|
||||
if (mRestrictBackground != null) {
|
||||
@@ -448,6 +479,7 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
|
||||
} else {
|
||||
bindData(0 /* position */);
|
||||
}
|
||||
mIsLoading = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,7 @@ import android.widget.ProgressBar;
|
||||
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.AppItem;
|
||||
import com.android.settingslib.net.UidDetail;
|
||||
import com.android.settingslib.net.UidDetailProvider;
|
||||
@@ -49,6 +50,9 @@ public class AppDataUsagePreference extends AppPreference {
|
||||
if (mDetail != null) {
|
||||
setAppInfo();
|
||||
} 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(() -> {
|
||||
mDetail = provider.getUidDetail(mItem.key, true /* blocking */);
|
||||
ThreadUtils.postOnMainThread(() -> setAppInfo());
|
||||
|
||||
@@ -190,8 +190,7 @@ 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()
|
||||
&& !info.getIsEuicc()) {
|
||||
if (info != null && portInfo.isActive() && info.isRemovable()) {
|
||||
activeRemovableLogicalSlotIds.add(portInfo.getLogicalSlotIndex());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +249,6 @@ 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,7 +592,6 @@ 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() && !slotInfo.getIsEuicc()) {
|
||||
if (slotInfo != null && slotInfo.isRemovable()) {
|
||||
return slotInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.android.settings.applications.AppInfoBase;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
@@ -240,6 +241,7 @@ public class AppDataUsageTest {
|
||||
ReflectionHelpers.setField(mFragment, "mUnrestrictedData", unrestrictedDataPref);
|
||||
ReflectionHelpers.setField(mFragment, "mDataSaverBackend", dataSaverBackend);
|
||||
ReflectionHelpers.setField(mFragment.services, "mPolicyManager", networkPolicyManager);
|
||||
when(mFragment.getListView()).thenReturn(mock(RecyclerView.class));
|
||||
|
||||
ShadowRestrictedLockUtilsInternal.setRestricted(true);
|
||||
doReturn(NetworkPolicyManager.POLICY_NONE).when(networkPolicyManager)
|
||||
|
||||
@@ -59,6 +59,7 @@ public class DefaultRingtonePreferenceTest {
|
||||
when(mDefaultRingtonePreference.getRingtoneType())
|
||||
.thenReturn(RingtoneManager.TYPE_RINGTONE);
|
||||
mDefaultRingtonePreference.setUserId(1);
|
||||
mDefaultRingtonePreference.mUserContext = context;
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user