Add null check when loading restricted profile apps.

In case the profile is being deleted.
Bug: 22235449

Change-Id: Ia67deb4e578edf79079ddc308b0750327c1ff85d
This commit is contained in:
Julia Reynolds
2015-08-17 13:09:47 -04:00
parent 516ee46c48
commit d7faba5c25

View File

@@ -30,6 +30,7 @@ import android.content.pm.IPackageManager;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ParceledListSlice;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
@@ -556,8 +557,11 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen
// Get the list of apps already installed for the user
mUserApps = null;
try {
mUserApps = ipm.getInstalledApplications(
PackageManager.GET_UNINSTALLED_PACKAGES, mUser.getIdentifier()).getList();
ParceledListSlice listSlice = ipm.getInstalledApplications(
PackageManager.GET_UNINSTALLED_PACKAGES, mUser.getIdentifier());
if (listSlice != null) {
mUserApps = listSlice.getList();
}
} catch (RemoteException re) {
}