* commit '4de4061c8bb9475cbc5d98f83bf3b2c8ec222407': Fix issue #7448596: Can't uninstall app that was installed by another user
This commit is contained in:
@@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@@ -358,7 +358,10 @@ public class InstalledAppDetails extends Fragment
|
|||||||
if ((mAppEntry.info.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
|
if ((mAppEntry.info.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
|
||||||
enabled = handleDisableable(mUninstallButton);
|
enabled = handleDisableable(mUninstallButton);
|
||||||
} else if ((mPackageInfo.applicationInfo.flags
|
} else if ((mPackageInfo.applicationInfo.flags
|
||||||
& ApplicationInfo.FLAG_INSTALLED) == 0) {
|
& ApplicationInfo.FLAG_INSTALLED) == 0
|
||||||
|
&& mUserManager.getUsers().size() >= 2) {
|
||||||
|
// When we have multiple users, there is a separate menu
|
||||||
|
// to uninstall for all users.
|
||||||
mUninstallButton.setText(R.string.uninstall_text);
|
mUninstallButton.setText(R.string.uninstall_text);
|
||||||
enabled = false;
|
enabled = false;
|
||||||
} else {
|
} else {
|
||||||
@@ -811,14 +814,19 @@ public class InstalledAppDetails extends Fragment
|
|||||||
// First time init: are we displaying an uninstalled app?
|
// First time init: are we displaying an uninstalled app?
|
||||||
mInitialized = true;
|
mInitialized = true;
|
||||||
mShowUninstalled = (mAppEntry.info.flags&ApplicationInfo.FLAG_INSTALLED) == 0;
|
mShowUninstalled = (mAppEntry.info.flags&ApplicationInfo.FLAG_INSTALLED) == 0;
|
||||||
} else if (!mShowUninstalled) {
|
} else {
|
||||||
// All other times: if we did not start out with the app uninstalled,
|
// All other times: if the app no longer exists then we want
|
||||||
// then if it becomes uninstalled we want to go away.
|
// to go away.
|
||||||
try {
|
try {
|
||||||
ApplicationInfo ainfo = getActivity().getPackageManager().getApplicationInfo(
|
ApplicationInfo ainfo = getActivity().getPackageManager().getApplicationInfo(
|
||||||
mAppEntry.info.packageName, PackageManager.GET_UNINSTALLED_PACKAGES
|
mAppEntry.info.packageName, PackageManager.GET_UNINSTALLED_PACKAGES
|
||||||
| PackageManager.GET_DISABLED_COMPONENTS);
|
| PackageManager.GET_DISABLED_COMPONENTS);
|
||||||
return (ainfo.flags&ApplicationInfo.FLAG_INSTALLED) != 0;
|
if (!mShowUninstalled) {
|
||||||
|
// If we did not start out with the app uninstalled, then
|
||||||
|
// it transitioning to the uninstalled state for the current
|
||||||
|
// user means we should go away as well.
|
||||||
|
return (ainfo.flags&ApplicationInfo.FLAG_INSTALLED) != 0;
|
||||||
|
}
|
||||||
} catch (NameNotFoundException e) {
|
} catch (NameNotFoundException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1286,11 +1294,7 @@ public class InstalledAppDetails extends Fragment
|
|||||||
.execute((Object)null);
|
.execute((Object)null);
|
||||||
}
|
}
|
||||||
} else if ((mAppEntry.info.flags & ApplicationInfo.FLAG_INSTALLED) == 0) {
|
} else if ((mAppEntry.info.flags & ApplicationInfo.FLAG_INSTALLED) == 0) {
|
||||||
try {
|
uninstallPkg(packageName, true, false);
|
||||||
mPm.installExistingPackage(packageName);
|
|
||||||
refreshUi();
|
|
||||||
} catch (NameNotFoundException e) {
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
uninstallPkg(packageName, false, false);
|
uninstallPkg(packageName, false, false);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user