Merge changes Ic95d219b,I58d82cbc

* changes:
  Don't add any trust agents if the controller is not available.
  Introduce boolean flags to show/hide items in Security & location.
This commit is contained in:
TreeHugger Robot
2018-01-18 19:54:09 +00:00
committed by Android (Google) Code Review
14 changed files with 193 additions and 17 deletions

View File

@@ -45,7 +45,7 @@ public class ManageDeviceAdminPreferenceController extends AbstractPreferenceCon
@Override
public boolean isAvailable() {
return true;
return mContext.getResources().getBoolean(R.bool.config_show_manage_device_admin);
}
@Override

View File

@@ -67,7 +67,7 @@ public class ChangeScreenLockPreferenceController extends AbstractPreferenceCont
@Override
public boolean isAvailable() {
return true;
return mContext.getResources().getBoolean(R.bool.config_show_unlock_set_or_change);
}
@Override

View File

@@ -33,7 +33,8 @@ public class ScreenPinningPreferenceController extends BasePreferenceController
@Override
public int getAvailabilityStatus() {
return AVAILABLE;
return mContext.getResources().getBoolean(R.bool.config_show_screen_pinning_settings)
? AVAILABLE : DISABLED_UNSUPPORTED;
}
@Override

View File

@@ -23,6 +23,7 @@ import android.provider.Settings;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.core.TogglePreferenceController;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.R;
public class ShowPasswordPreferenceController extends TogglePreferenceController {
@@ -53,7 +54,9 @@ public class ShowPasswordPreferenceController extends TogglePreferenceController
@Override
public int getAvailabilityStatus() {
return AVAILABLE;
return mContext.getResources().getBoolean(R.bool.config_show_show_password)
? AVAILABLE : DISABLED_UNSUPPORTED;
}
}

View File

@@ -47,7 +47,8 @@ public class ManageTrustAgentsPreferenceController extends BasePreferenceControl
@Override
public int getAvailabilityStatus() {
return AVAILABLE;
return mContext.getResources().getBoolean(R.bool.config_show_manage_trust_agents)
? AVAILABLE : DISABLED_UNSUPPORTED;
}
@Override

View File

@@ -79,7 +79,7 @@ public class TrustAgentListPreferenceController extends AbstractPreferenceContro
@Override
public boolean isAvailable() {
return true;
return mContext.getResources().getBoolean(R.bool.config_show_trust_agent_click_intent);
}
@Override
@@ -146,6 +146,10 @@ public class TrustAgentListPreferenceController extends AbstractPreferenceContro
mSecurityCategory.removePreference(oldAgent);
}
}
// If for some reason the preference is no longer available, don't proceed to add.
if (!isAvailable()) {
return;
}
// Then add new ones.
final boolean hasSecurity = mLockPatternUtils.isSecure(MY_USER_ID);
final List<TrustAgentManager.TrustAgentComponentInfo> agents =