Add new Always on display slice

Currently we create Always on Display slice through
AmbientDisplayAlwaysOnPreferenceController. However, as the Always on
Display is merged into Idle lock screen, the conversion won't work
properly anymore when devices support the aware sensor.

Hence, we create another custom slice for this purpose.

Bug: 145920511
Test: manual & robotest

Change-Id: Ifd90e2de5219bd4e97aa13b5855fdab95ff6c4d0
This commit is contained in:
Edgar Wang
2020-06-04 23:21:32 +08:00
parent 1821ab5e5b
commit e1186254d4
3 changed files with 280 additions and 0 deletions

View File

@@ -27,6 +27,7 @@ import android.util.ArrayMap;
import androidx.annotation.VisibleForTesting;
import com.android.settings.display.AdaptiveSleepPreferenceController;
import com.android.settings.display.AlwaysOnDisplaySlice;
import com.android.settings.flashlight.FlashlightSlice;
import com.android.settings.fuelgauge.batterytip.BatteryTipPreferenceController;
import com.android.settings.homepage.contextualcards.deviceinfo.StorageSlice;
@@ -324,6 +325,16 @@ public class CustomSliceRegistry {
.appendPath(MediaOutputSliceConstants.KEY_REMOTE_MEDIA)
.build();
/**
* Backing Uri for the Always On Slice.
*/
public static final Uri ALWAYS_ON_SLICE_URI = new Uri.Builder()
.scheme(ContentResolver.SCHEME_CONTENT)
.authority(SettingsSliceProvider.SLICE_AUTHORITY)
.appendPath(SettingsSlicesContract.PATH_SETTING_ACTION)
.appendPath("always_on_display")
.build();
@VisibleForTesting
static final Map<Uri, Class<? extends CustomSliceable>> sUriToSlice;
@@ -349,6 +360,7 @@ public class CustomSliceRegistry {
sUriToSlice.put(DARK_THEME_SLICE_URI, DarkThemeSlice.class);
sUriToSlice.put(REMOTE_MEDIA_SLICE_URI, RemoteMediaSlice.class);
sUriToSlice.put(MEDIA_OUTPUT_GROUP_SLICE_URI, MediaOutputGroupSlice.class);
sUriToSlice.put(ALWAYS_ON_SLICE_URI, AlwaysOnDisplaySlice.class);
}
public static Class<? extends CustomSliceable> getSliceClassByUri(Uri uri) {