private UserManager mUserManager;
private PackageManager mPm;
- private boolean mFinishing;
+ @VisibleForTesting
+ boolean mFinishing;
private boolean mListeningToPackageRemove;
@VisibleForTesting
void retrieveAppEntry() {
final Activity activity = getActivity();
- if (activity == null) {
+ if (activity == null || mFinishing) {
return;
}
if (mState == null) {
|| TextUtils.equals(mAppEntry.info.packageName, packageName)) {
onPackageRemoved();
} else if (mAppEntry.info.isResourceOverlay()
- && TextUtils.equals(mPackageInfo.overlayTarget, packageName)) {
+ && TextUtils.equals(mPackageInfo.overlayTarget, packageName)) {
refreshUi();
}
}
}
@Test
+ public void getPreferenceControllers_exiting_shouldReturnNull() {
+ mFragment.mFinishing = true;
+
+ assertThat(mFragment.createPreferenceControllers(mShadowContext)).isNull();
+ }
+
+ @Test
public void getNumberOfUserWithPackageInstalled_twoUsersInstalled_shouldReturnTwo()
throws PackageManager.NameNotFoundException {
final String packageName = "Package1";