Home Controls: Add Device Controls settings
Add a setting that would not require authorization for device controls. Fixes: 216102581 Test: manual Change-Id: I1fd98a2fbc1cea44d0b2c3612dd1616a053af394
This commit is contained in:
@@ -21,8 +21,13 @@ import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROF
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.database.ContentObserver;
|
||||
import android.hardware.display.AmbientDisplayConfiguration;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
@@ -68,6 +73,8 @@ public class LockscreenDashboardFragment extends DashboardFragment
|
||||
|
||||
private AmbientDisplayConfiguration mConfig;
|
||||
private OwnerInfoPreferenceController mOwnerInfoPreferenceController;
|
||||
@VisibleForTesting
|
||||
ContentObserver mControlsContentObserver;
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
@@ -106,6 +113,27 @@ public class LockscreenDashboardFragment extends DashboardFragment
|
||||
use(AmbientDisplayNotificationsPreferenceController.class).setConfig(getConfig(context));
|
||||
use(DoubleTapScreenPreferenceController.class).setConfig(getConfig(context));
|
||||
use(PickupGesturePreferenceController.class).setConfig(getConfig(context));
|
||||
|
||||
mControlsContentObserver = new ContentObserver(
|
||||
new Handler(Looper.getMainLooper())) {
|
||||
@Override
|
||||
public void onChange(boolean selfChange, Uri uri) {
|
||||
super.onChange(selfChange, uri);
|
||||
updatePreferenceStates();
|
||||
}
|
||||
};
|
||||
context.getContentResolver().registerContentObserver(
|
||||
Settings.Secure.getUriFor(Settings.Secure.LOCKSCREEN_SHOW_CONTROLS),
|
||||
false /* notifyForDescendants */, mControlsContentObserver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
if (mControlsContentObserver != null) {
|
||||
getContext().getContentResolver().unregisterContentObserver(mControlsContentObserver);
|
||||
mControlsContentObserver = null;
|
||||
}
|
||||
super.onDetach();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user