Fix updates of the enable/disable button
Make the entire ApplicationsState resume and do way too much work so that we can get a little bit of state. ApplicationsState could use some refactoring. Bug: 21518528 Change-Id: Ibb6a2c15948f9bc69490426d4004dc83582087b4
This commit is contained in:
@@ -54,6 +54,7 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment
|
|||||||
protected boolean mAppControlRestricted = false;
|
protected boolean mAppControlRestricted = false;
|
||||||
|
|
||||||
protected ApplicationsState mState;
|
protected ApplicationsState mState;
|
||||||
|
protected ApplicationsState.Session mSession;
|
||||||
protected ApplicationsState.AppEntry mAppEntry;
|
protected ApplicationsState.AppEntry mAppEntry;
|
||||||
protected PackageInfo mPackageInfo;
|
protected PackageInfo mPackageInfo;
|
||||||
protected int mUserId;
|
protected int mUserId;
|
||||||
@@ -75,6 +76,7 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment
|
|||||||
mFinishing = false;
|
mFinishing = false;
|
||||||
|
|
||||||
mState = ApplicationsState.getInstance(getActivity().getApplication());
|
mState = ApplicationsState.getInstance(getActivity().getApplication());
|
||||||
|
mSession = mState.newSession(this);
|
||||||
Context context = getActivity();
|
Context context = getActivity();
|
||||||
mDpm = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
|
mDpm = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
|
||||||
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
||||||
@@ -88,6 +90,7 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment
|
|||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
mSession.resume();
|
||||||
mAppControlRestricted = mUserManager.hasUserRestriction(UserManager.DISALLOW_APPS_CONTROL);
|
mAppControlRestricted = mUserManager.hasUserRestriction(UserManager.DISALLOW_APPS_CONTROL);
|
||||||
|
|
||||||
if (!refreshUi()) {
|
if (!refreshUi()) {
|
||||||
@@ -95,6 +98,12 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
mSession.pause();
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
protected String retrieveAppEntry() {
|
protected String retrieveAppEntry() {
|
||||||
final Bundle args = getArguments();
|
final Bundle args = getArguments();
|
||||||
mPackageName = (args != null) ? args.getString(ARG_PACKAGE_NAME) : null;
|
mPackageName = (args != null) ? args.getString(ARG_PACKAGE_NAME) : null;
|
||||||
|
Reference in New Issue
Block a user