Don't show uninstall icon when user restricted
When the user can't uninstall apps from settings, also don't show the icon to let them do it from here. Change-Id: I3b203711630a4ff0ba4a5928667c9f09f9479aeb
This commit is contained in:
1 parent
9f0386fbcc
commit
950a467b18
1 file changed
+9
@@ -30,6 +30,7 @@ import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.TransitionDrawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.UserManager;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewConfiguration;
|
||||
@@ -187,6 +188,14 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
||||
if (!willAcceptDrop(info) || isAllAppsWidget(source, info)) {
|
||||
isVisible = false;
|
||||
}
|
||||
if (useUninstallLabel) {
|
||||
UserManager userManager = (UserManager)
|
||||
getContext().getSystemService(Context.USER_SERVICE);
|
||||
if (userManager.hasUserRestriction(UserManager.DISALLOW_APPS_CONTROL)
|
||||
|| userManager.hasUserRestriction(UserManager.DISALLOW_UNINSTALL_APPS)) {
|
||||
isVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (useUninstallLabel) {
|
||||
setCompoundDrawablesRelativeWithIntrinsicBounds(mUninstallDrawable, null, null, null);
|
||||
|
||||
Reference in new issue
Block a user