Clean up AwareFeatureProvider from Settings

Bug: 287566056
Test: m Settings
Change-Id: I7f7f57809c55bf8824b427f0d4a232cacdbe88a7
This commit is contained in:
Chaohui Wang
2023-06-19 22:58:18 +08:00
parent 5464140360
commit 2e4141e4ab
15 changed files with 5 additions and 259 deletions

View File

@@ -36,8 +36,6 @@ import androidx.slice.builders.SliceAction;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.aware.AwareFeatureProvider;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.slices.CustomSliceRegistry;
import com.android.settings.slices.CustomSliceable;
@@ -59,12 +57,10 @@ public class AlwaysOnDisplaySlice implements CustomSliceable {
private final Context mContext;
private final AmbientDisplayConfiguration mConfig;
private final AwareFeatureProvider mFeatureProvider;
public AlwaysOnDisplaySlice(Context context) {
mContext = context;
mConfig = new AmbientDisplayConfiguration(mContext);
mFeatureProvider = FeatureFactory.getFactory(context).getAwareFeatureProvider();
}
@Override
@@ -107,12 +103,9 @@ public class AlwaysOnDisplaySlice implements CustomSliceable {
final boolean isChecked = intent.getBooleanExtra(android.app.slice.Slice.EXTRA_TOGGLE_STATE,
false);
final ContentResolver resolver = mContext.getContentResolver();
final boolean isAwareSupported = mFeatureProvider.isSupported(mContext);
final boolean isAwareEnabled = mFeatureProvider.isEnabled(mContext);
Settings.Secure.putInt(resolver, DOZE_ALWAYS_ON, isChecked ? 1 : 0);
Settings.Secure.putInt(resolver, DOZE_WAKE_DISPLAY_GESTURE,
(isAwareEnabled && isAwareSupported && isChecked) ? 1 : 0);
Settings.Secure.putInt(resolver, DOZE_WAKE_DISPLAY_GESTURE, 0);
}
@Override