Loading packages/SystemUI/res/drawable/ic_qs_aod.xml 0 → 100644 +11 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <path android:fillColor="#ffffff" android:pathData="M17,19 L17,5 L7,5 L7,19 L17,19 M17,1 C18.1046,1,19,1.89543,19,3 L19,21 C19,22.1046,18.1046,23,17,23 L7,23 C5.89,23,5,22.1,5,21 L5,3 C5,1.89,5.89,1,7,1 L17,1 M9,7 L15,7 L15,9 L9,9 L9,7" /> </vector> packages/SystemUI/res/values/cm_strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -107,6 +107,9 @@ <string name="vpn_credentials_password">Password</string> <string name="vpn_credentials_dialog_connect">Connect</string> <!-- AOD QS tile --> <string name="quick_settings_aod_label">AOD</string> <!-- Content description of the location tile in quick settings when on, battery saving mode (not shown on the screen). [CHAR LIMIT=NONE] --> <string name="accessibility_quick_settings_location_battery_saving">Location reporting: battery saving mode.</string> <!-- Content description of the location tile in quick settings when on, sensors only mode (not shown on the screen). [CHAR LIMIT=NONE] --> Loading packages/SystemUI/res/values/config.xml +1 −1 Original line number Diff line number Diff line Loading @@ -117,7 +117,7 @@ <!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" --> <string name="quick_settings_tiles_stock" translatable="false"> wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,nfc,location,hotspot,inversion,saver,dark,work,cast,night,adb_network,ambient_display,caffeine,heads_up,livedisplay,reading_mode,sync,usb_tether,volume_panel,vpn,profiles wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,nfc,location,hotspot,inversion,saver,dark,work,cast,night,adb_network,ambient_display,caffeine,heads_up,livedisplay,aod,reading_mode,sync,usb_tether,volume_panel,vpn,profiles </string> <!-- The tiles to display in QuickSettings --> Loading packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java +7 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import com.android.systemui.plugins.qs.QSTile; import com.android.systemui.plugins.qs.QSTileView; import com.android.systemui.qs.QSTileHost; import com.android.systemui.qs.external.CustomTile; import com.android.systemui.qs.tiles.AODTile; import com.android.systemui.qs.tiles.AdbOverNetworkTile; import com.android.systemui.qs.tiles.AirplaneModeTile; import com.android.systemui.qs.tiles.AmbientDisplayTile; Loading Loading @@ -92,6 +93,7 @@ public class QSFactoryImpl implements QSFactory { private final Provider<CaffeineTile> mCaffeineTileProvider; private final Provider<HeadsUpTile> mHeadsUpTileProvider; private final Provider<LiveDisplayTile> mLiveDisplayTileProvider; private final Provider<AODTile> mAODTileProvider; private final Provider<ProfilesTile> mProfilesTileProvider; private final Provider<ReadingModeTile> mReadingModeTileProvider; private final Provider<SyncTile> mSyncTileProvider; Loading Loading @@ -131,7 +133,8 @@ public class QSFactoryImpl implements QSFactory { Provider<SyncTile> syncTileProvider, Provider<UsbTetherTile> usbTetherTileProvider, Provider<VolumeTile> volumeTileProvider, Provider<VpnTile> vpnTileProvider) { Provider<VpnTile> vpnTileProvider, Provider<AODTile> aodTileProvider) { mWifiTileProvider = wifiTileProvider; mBluetoothTileProvider = bluetoothTileProvider; mCellularTileProvider = cellularTileProvider; Loading @@ -156,6 +159,7 @@ public class QSFactoryImpl implements QSFactory { mCaffeineTileProvider = caffeineTileProvider; mHeadsUpTileProvider = headsUpTileProvider; mLiveDisplayTileProvider = liveDisplayTileProvider; mAODTileProvider = aodTileProvider; mProfilesTileProvider = profilesTileProvider; mReadingModeTileProvider = readingModeTileProvider; mSyncTileProvider = syncTileProvider; Loading Loading @@ -226,6 +230,8 @@ public class QSFactoryImpl implements QSFactory { return mHeadsUpTileProvider.get(); case "livedisplay": return mLiveDisplayTileProvider.get(); case "aod": return mAODTileProvider.get(); case "profiles": return mProfilesTileProvider.get(); case "reading_mode": Loading packages/SystemUI/src/com/android/systemui/qs/tiles/AODTile.java 0 → 100644 +97 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The OmniROM Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.qs.tiles; import android.content.Intent; import android.provider.Settings; import android.service.quicksettings.Tile; import com.android.systemui.R; import com.android.systemui.plugins.qs.QSTile.BooleanState; import com.android.systemui.qs.QSHost; import com.android.systemui.qs.tileimpl.QSTileImpl; import org.lineageos.internal.logging.LineageMetricsLogger; import javax.inject.Inject; public class AODTile extends QSTileImpl<BooleanState> { private boolean mAodDisabled; private final Icon mIcon = ResourceIcon.get(R.drawable.ic_qs_aod); @Inject public AODTile(QSHost host) { super(host); mAodDisabled = Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.DOZE_ALWAYS_ON, 1) == 0; } @Override public boolean isAvailable() { return mContext.getResources().getBoolean( com.android.internal.R.bool.config_dozeAlwaysOnDisplayAvailable); } @Override public BooleanState newTileState() { return new BooleanState(); } @Override public void handleClick() { mAodDisabled = !mAodDisabled; Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.DOZE_ALWAYS_ON, mAodDisabled ? 0 : 1); refreshState(); } @Override public Intent getLongClickIntent() { return null; } @Override public CharSequence getTileLabel() { return mContext.getString(R.string.quick_settings_aod_label); } @Override protected void handleUpdateState(BooleanState state, Object arg) { if (state.slash == null) { state.slash = new SlashState(); } state.icon = mIcon; state.value = mAodDisabled; state.slash.isSlashed = state.value; state.label = mContext.getString(R.string.quick_settings_aod_label); if (mAodDisabled) { state.state = Tile.STATE_INACTIVE; } else { state.state = Tile.STATE_ACTIVE; } } @Override public int getMetricsCategory() { return LineageMetricsLogger.TILE_AOD; } @Override public void handleSetListening(boolean listening) { } } Loading
packages/SystemUI/res/drawable/ic_qs_aod.xml 0 → 100644 +11 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <path android:fillColor="#ffffff" android:pathData="M17,19 L17,5 L7,5 L7,19 L17,19 M17,1 C18.1046,1,19,1.89543,19,3 L19,21 C19,22.1046,18.1046,23,17,23 L7,23 C5.89,23,5,22.1,5,21 L5,3 C5,1.89,5.89,1,7,1 L17,1 M9,7 L15,7 L15,9 L9,9 L9,7" /> </vector>
packages/SystemUI/res/values/cm_strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -107,6 +107,9 @@ <string name="vpn_credentials_password">Password</string> <string name="vpn_credentials_dialog_connect">Connect</string> <!-- AOD QS tile --> <string name="quick_settings_aod_label">AOD</string> <!-- Content description of the location tile in quick settings when on, battery saving mode (not shown on the screen). [CHAR LIMIT=NONE] --> <string name="accessibility_quick_settings_location_battery_saving">Location reporting: battery saving mode.</string> <!-- Content description of the location tile in quick settings when on, sensors only mode (not shown on the screen). [CHAR LIMIT=NONE] --> Loading
packages/SystemUI/res/values/config.xml +1 −1 Original line number Diff line number Diff line Loading @@ -117,7 +117,7 @@ <!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" --> <string name="quick_settings_tiles_stock" translatable="false"> wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,nfc,location,hotspot,inversion,saver,dark,work,cast,night,adb_network,ambient_display,caffeine,heads_up,livedisplay,reading_mode,sync,usb_tether,volume_panel,vpn,profiles wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,nfc,location,hotspot,inversion,saver,dark,work,cast,night,adb_network,ambient_display,caffeine,heads_up,livedisplay,aod,reading_mode,sync,usb_tether,volume_panel,vpn,profiles </string> <!-- The tiles to display in QuickSettings --> Loading
packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java +7 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import com.android.systemui.plugins.qs.QSTile; import com.android.systemui.plugins.qs.QSTileView; import com.android.systemui.qs.QSTileHost; import com.android.systemui.qs.external.CustomTile; import com.android.systemui.qs.tiles.AODTile; import com.android.systemui.qs.tiles.AdbOverNetworkTile; import com.android.systemui.qs.tiles.AirplaneModeTile; import com.android.systemui.qs.tiles.AmbientDisplayTile; Loading Loading @@ -92,6 +93,7 @@ public class QSFactoryImpl implements QSFactory { private final Provider<CaffeineTile> mCaffeineTileProvider; private final Provider<HeadsUpTile> mHeadsUpTileProvider; private final Provider<LiveDisplayTile> mLiveDisplayTileProvider; private final Provider<AODTile> mAODTileProvider; private final Provider<ProfilesTile> mProfilesTileProvider; private final Provider<ReadingModeTile> mReadingModeTileProvider; private final Provider<SyncTile> mSyncTileProvider; Loading Loading @@ -131,7 +133,8 @@ public class QSFactoryImpl implements QSFactory { Provider<SyncTile> syncTileProvider, Provider<UsbTetherTile> usbTetherTileProvider, Provider<VolumeTile> volumeTileProvider, Provider<VpnTile> vpnTileProvider) { Provider<VpnTile> vpnTileProvider, Provider<AODTile> aodTileProvider) { mWifiTileProvider = wifiTileProvider; mBluetoothTileProvider = bluetoothTileProvider; mCellularTileProvider = cellularTileProvider; Loading @@ -156,6 +159,7 @@ public class QSFactoryImpl implements QSFactory { mCaffeineTileProvider = caffeineTileProvider; mHeadsUpTileProvider = headsUpTileProvider; mLiveDisplayTileProvider = liveDisplayTileProvider; mAODTileProvider = aodTileProvider; mProfilesTileProvider = profilesTileProvider; mReadingModeTileProvider = readingModeTileProvider; mSyncTileProvider = syncTileProvider; Loading Loading @@ -226,6 +230,8 @@ public class QSFactoryImpl implements QSFactory { return mHeadsUpTileProvider.get(); case "livedisplay": return mLiveDisplayTileProvider.get(); case "aod": return mAODTileProvider.get(); case "profiles": return mProfilesTileProvider.get(); case "reading_mode": Loading
packages/SystemUI/src/com/android/systemui/qs/tiles/AODTile.java 0 → 100644 +97 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The OmniROM Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.qs.tiles; import android.content.Intent; import android.provider.Settings; import android.service.quicksettings.Tile; import com.android.systemui.R; import com.android.systemui.plugins.qs.QSTile.BooleanState; import com.android.systemui.qs.QSHost; import com.android.systemui.qs.tileimpl.QSTileImpl; import org.lineageos.internal.logging.LineageMetricsLogger; import javax.inject.Inject; public class AODTile extends QSTileImpl<BooleanState> { private boolean mAodDisabled; private final Icon mIcon = ResourceIcon.get(R.drawable.ic_qs_aod); @Inject public AODTile(QSHost host) { super(host); mAodDisabled = Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.DOZE_ALWAYS_ON, 1) == 0; } @Override public boolean isAvailable() { return mContext.getResources().getBoolean( com.android.internal.R.bool.config_dozeAlwaysOnDisplayAvailable); } @Override public BooleanState newTileState() { return new BooleanState(); } @Override public void handleClick() { mAodDisabled = !mAodDisabled; Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.DOZE_ALWAYS_ON, mAodDisabled ? 0 : 1); refreshState(); } @Override public Intent getLongClickIntent() { return null; } @Override public CharSequence getTileLabel() { return mContext.getString(R.string.quick_settings_aod_label); } @Override protected void handleUpdateState(BooleanState state, Object arg) { if (state.slash == null) { state.slash = new SlashState(); } state.icon = mIcon; state.value = mAodDisabled; state.slash.isSlashed = state.value; state.label = mContext.getString(R.string.quick_settings_aod_label); if (mAodDisabled) { state.state = Tile.STATE_INACTIVE; } else { state.state = Tile.STATE_ACTIVE; } } @Override public int getMetricsCategory() { return LineageMetricsLogger.TILE_AOD; } @Override public void handleSetListening(boolean listening) { } }