Apply user restriction checks to app info screen in settings.
Bug: 14081992 Change-Id: Id90c00df600c19820dcbc391a09cc6a58e673d0e
This commit is contained in:
@@ -126,6 +126,7 @@ public class InstalledAppDetails extends Fragment
|
|||||||
private CheckBox mAskCompatibilityCB;
|
private CheckBox mAskCompatibilityCB;
|
||||||
private CheckBox mEnableCompatibilityCB;
|
private CheckBox mEnableCompatibilityCB;
|
||||||
private boolean mCanClearData = true;
|
private boolean mCanClearData = true;
|
||||||
|
private boolean mAppControlRestricted = false;
|
||||||
private TextView mAppVersion;
|
private TextView mAppVersion;
|
||||||
private TextView mTotalSize;
|
private TextView mTotalSize;
|
||||||
private TextView mAppSize;
|
private TextView mAppSize;
|
||||||
@@ -264,6 +265,10 @@ public class InstalledAppDetails extends Fragment
|
|||||||
}
|
}
|
||||||
mClearDataButton.setOnClickListener(this);
|
mClearDataButton.setOnClickListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mAppControlRestricted) {
|
||||||
|
mClearDataButton.setEnabled(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private CharSequence getMoveErrMsg(int errCode) {
|
private CharSequence getMoveErrMsg(int errCode) {
|
||||||
@@ -303,7 +308,7 @@ public class InstalledAppDetails extends Fragment
|
|||||||
mCanBeOnSdCardChecker.init();
|
mCanBeOnSdCardChecker.init();
|
||||||
moveDisable = !mCanBeOnSdCardChecker.check(mAppEntry.info);
|
moveDisable = !mCanBeOnSdCardChecker.check(mAppEntry.info);
|
||||||
}
|
}
|
||||||
if (moveDisable) {
|
if (moveDisable || mAppControlRestricted) {
|
||||||
mMoveAppButton.setEnabled(false);
|
mMoveAppButton.setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
mMoveAppButton.setOnClickListener(this);
|
mMoveAppButton.setOnClickListener(this);
|
||||||
@@ -388,6 +393,10 @@ public class InstalledAppDetails extends Fragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mAppControlRestricted) {
|
||||||
|
enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
mUninstallButton.setEnabled(enabled);
|
mUninstallButton.setEnabled(enabled);
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
// Register listener
|
// Register listener
|
||||||
@@ -580,6 +589,7 @@ public class InstalledAppDetails extends Fragment
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
|
mAppControlRestricted = mUserManager.hasUserRestriction(UserManager.DISALLOW_APPS_CONTROL);
|
||||||
mSession.resume();
|
mSession.resume();
|
||||||
if (!refreshUi()) {
|
if (!refreshUi()) {
|
||||||
setIntentAndFinish(true, true);
|
setIntentAndFinish(true, true);
|
||||||
@@ -1008,6 +1018,10 @@ public class InstalledAppDetails extends Fragment
|
|||||||
mClearCacheButton.setOnClickListener(this);
|
mClearCacheButton.setOnClickListener(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (mAppControlRestricted) {
|
||||||
|
mClearCacheButton.setEnabled(false);
|
||||||
|
mClearDataButton.setEnabled(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1261,8 +1275,12 @@ public class InstalledAppDetails extends Fragment
|
|||||||
};
|
};
|
||||||
|
|
||||||
private void updateForceStopButton(boolean enabled) {
|
private void updateForceStopButton(boolean enabled) {
|
||||||
mForceStopButton.setEnabled(enabled);
|
if (mAppControlRestricted) {
|
||||||
mForceStopButton.setOnClickListener(InstalledAppDetails.this);
|
mForceStopButton.setEnabled(false);
|
||||||
|
} else {
|
||||||
|
mForceStopButton.setEnabled(enabled);
|
||||||
|
mForceStopButton.setOnClickListener(InstalledAppDetails.this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkForceStop() {
|
private void checkForceStop() {
|
||||||
|
Reference in New Issue
Block a user