mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-25 07:29:24 -05:00
Expose the Sensors Off tile
This removes the hidden development 'Sensors off' tile from Settings app, adds it back to SystemUI, and enables it by default. Tested working on 18.1 Signed-off-by: Tad <tad@spotco.us>
This commit is contained in:
parent
35372142ed
commit
c6df37ca23
@ -3,7 +3,7 @@
|
||||
|
||||
<!-- The default tiles to display in QuickSettings -->
|
||||
<string name="quick_settings_tiles_default" translatable="false">
|
||||
wifi,cell,bt,dnd,flashlight,rotation,battery,location,airplane,caffeine,saver,hotspot,nfc,sync
|
||||
wifi,cell,bt,sensorprivacy,flashlight,location,rotation,battery,airplane,dnd,caffeine,dark,saver,hotspot,nfc,sync
|
||||
</string>
|
||||
|
||||
<!-- Whether to use cheap, less good looking shadows for recents -->
|
||||
|
@ -0,0 +1,264 @@
|
||||
From 57106526e814f24b8eb7dd33f62f53ff50864d73 Mon Sep 17 00:00:00 2001
|
||||
From: Tad <tad@spotco.us>
|
||||
Date: Sun, 26 Sep 2021 14:15:01 -0400
|
||||
Subject: [PATCH] Restore Sensors Off tile
|
||||
|
||||
Was moved to Settings under Developer options in a51ea81f4445
|
||||
|
||||
Signed-off-by: Tad <tad@spotco.us>
|
||||
Change-Id: I043d1c6992595f5f074baea15b47cc5d1f2fac3b
|
||||
---
|
||||
.../res/drawable/ic_signal_sensors.xml | 40 ++++++
|
||||
packages/SystemUI/res/values/config.xml | 2 +-
|
||||
.../systemui/qs/tileimpl/QSFactoryImpl.java | 6 +
|
||||
.../systemui/qs/tiles/SensorPrivacyTile.java | 133 ++++++++++++++++++
|
||||
4 files changed, 180 insertions(+), 1 deletion(-)
|
||||
create mode 100644 packages/SystemUI/res/drawable/ic_signal_sensors.xml
|
||||
create mode 100644 packages/SystemUI/src/com/android/systemui/qs/tiles/SensorPrivacyTile.java
|
||||
|
||||
diff --git a/packages/SystemUI/res/drawable/ic_signal_sensors.xml b/packages/SystemUI/res/drawable/ic_signal_sensors.xml
|
||||
new file mode 100644
|
||||
index 000000000000..b9b3500593a5
|
||||
--- /dev/null
|
||||
+++ b/packages/SystemUI/res/drawable/ic_signal_sensors.xml
|
||||
@@ -0,0 +1,40 @@
|
||||
+<!--
|
||||
+ Copyright (C) 2019 The Android Open Source 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.
|
||||
+-->
|
||||
+
|
||||
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
+ android:width="24dp"
|
||||
+ android:height="24dp"
|
||||
+ android:viewportWidth="24.0"
|
||||
+ android:viewportHeight="24.0"
|
||||
+ android:tint="?android:attr/colorControlNormal">
|
||||
+ <path
|
||||
+ android:pathData="M21.966,2 L2,22"
|
||||
+ android:strokeLineCap="round"
|
||||
+ android:strokeColor="#000000"
|
||||
+ android:fillColor="#00000000"
|
||||
+ android:strokeWidth="1.6521436"
|
||||
+ android:strokeLineJoin="miter"
|
||||
+ android:strokeAlpha="1"/>
|
||||
+ <path
|
||||
+ android:pathData="M0.752,12L4.496,12l2.496,-6.25 2.496,12.5 2.496,-15 2.496,12.5 2.496,-7.5 1.248,3.75h4.992"
|
||||
+ android:strokeLineCap="round"
|
||||
+ android:strokeColor="#000000"
|
||||
+ android:fillColor="#00000000"
|
||||
+ android:strokeWidth="1.25090861"
|
||||
+ android:strokeLineJoin="round"
|
||||
+ android:strokeAlpha="1"/>
|
||||
+</vector>
|
||||
+
|
||||
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
|
||||
index f99dc023a9f8..0102013c3f87 100644
|
||||
--- a/packages/SystemUI/res/values/config.xml
|
||||
+++ b/packages/SystemUI/res/values/config.xml
|
||||
@@ -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,aod,reading_mode,sync,usb_tether,volume_panel,vpn,profiles,powershare
|
||||
+ 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,powershare,sensorprivacy
|
||||
</string>
|
||||
|
||||
<!-- The tiles to display in QuickSettings -->
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
|
||||
index 756d1fd53ac3..9b3653a01449 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
|
||||
@@ -51,6 +51,7 @@ import com.android.systemui.qs.tiles.PowerShareTile;
|
||||
import com.android.systemui.qs.tiles.ProfilesTile;
|
||||
import com.android.systemui.qs.tiles.ReadingModeTile;
|
||||
import com.android.systemui.qs.tiles.RotationLockTile;
|
||||
+import com.android.systemui.qs.tiles.SensorPrivacyTile;
|
||||
import com.android.systemui.qs.tiles.SyncTile;
|
||||
import com.android.systemui.qs.tiles.UiModeNightTile;
|
||||
import com.android.systemui.qs.tiles.UsbTetherTile;
|
||||
@@ -87,6 +88,7 @@ public class QSFactoryImpl implements QSFactory {
|
||||
private final Provider<DataSaverTile> mDataSaverTileProvider;
|
||||
private final Provider<NightDisplayTile> mNightDisplayTileProvider;
|
||||
private final Provider<NfcTile> mNfcTileProvider;
|
||||
+ private final Provider<SensorPrivacyTile> mSensorPrivacyTileProvider;
|
||||
private final Provider<GarbageMonitor.MemoryTile> mMemoryTileProvider;
|
||||
private final Provider<UiModeNightTile> mUiModeNightTileProvider;
|
||||
private final Provider<AdbOverNetworkTile> mAdbOverNetworkTileProvider;
|
||||
@@ -123,6 +125,7 @@ public class QSFactoryImpl implements QSFactory {
|
||||
Provider<DataSaverTile> dataSaverTileProvider,
|
||||
Provider<NightDisplayTile> nightDisplayTileProvider,
|
||||
Provider<NfcTile> nfcTileProvider,
|
||||
+ Provider<SensorPrivacyTile> sensorPrivacyTileProvider,
|
||||
Provider<GarbageMonitor.MemoryTile> memoryTileProvider,
|
||||
Provider<UiModeNightTile> uiModeNightTileProvider,
|
||||
Provider<AdbOverNetworkTile> adbOverNetworkTileProvider,
|
||||
@@ -155,6 +158,7 @@ public class QSFactoryImpl implements QSFactory {
|
||||
mDataSaverTileProvider = dataSaverTileProvider;
|
||||
mNightDisplayTileProvider = nightDisplayTileProvider;
|
||||
mNfcTileProvider = nfcTileProvider;
|
||||
+ mSensorPrivacyTileProvider = sensorPrivacyTileProvider;
|
||||
mMemoryTileProvider = memoryTileProvider;
|
||||
mUiModeNightTileProvider = uiModeNightTileProvider;
|
||||
mAdbOverNetworkTileProvider = adbOverNetworkTileProvider;
|
||||
@@ -221,6 +225,8 @@ public class QSFactoryImpl implements QSFactory {
|
||||
return mNightDisplayTileProvider.get();
|
||||
case "nfc":
|
||||
return mNfcTileProvider.get();
|
||||
+ case "sensorprivacy":
|
||||
+ return mSensorPrivacyTileProvider.get();
|
||||
case "dark":
|
||||
return mUiModeNightTileProvider.get();
|
||||
// Custom tiles.
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/SensorPrivacyTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/SensorPrivacyTile.java
|
||||
new file mode 100644
|
||||
index 000000000000..941e1d44e145
|
||||
--- /dev/null
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/SensorPrivacyTile.java
|
||||
@@ -0,0 +1,133 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2018 The Android Open Source 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.Context;
|
||||
+import android.content.Intent;
|
||||
+import android.hardware.SensorPrivacyManager;
|
||||
+import android.service.quicksettings.Tile;
|
||||
+import android.widget.Switch;
|
||||
+
|
||||
+import com.android.internal.logging.MetricsLogger;
|
||||
+import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
+import com.android.systemui.R;
|
||||
+import com.android.systemui.plugins.ActivityStarter;
|
||||
+import com.android.systemui.plugins.qs.QSTile.BooleanState;
|
||||
+import com.android.systemui.qs.QSHost;
|
||||
+import com.android.systemui.qs.tileimpl.QSTileImpl;
|
||||
+import android.app.KeyguardManager;
|
||||
+
|
||||
+import javax.inject.Inject;
|
||||
+
|
||||
+/** Quick settings tile: SensorPrivacy mode **/
|
||||
+public class SensorPrivacyTile extends QSTileImpl<BooleanState> implements
|
||||
+ SensorPrivacyManager.OnSensorPrivacyChangedListener {
|
||||
+ private static final String TAG = "SensorPrivacy";
|
||||
+ private final Icon mIcon =
|
||||
+ ResourceIcon.get(R.drawable.ic_signal_sensors);
|
||||
+ private KeyguardManager mKeyguardManager;
|
||||
+ private final SensorPrivacyManager mSensorPrivacyManager;
|
||||
+ private final ActivityStarter mActivityStarter;
|
||||
+
|
||||
+ @Inject
|
||||
+ public SensorPrivacyTile(QSHost host, SensorPrivacyManager sensorPrivacyManager,
|
||||
+ ActivityStarter activityStarter) {
|
||||
+ super(host);
|
||||
+
|
||||
+ mSensorPrivacyManager = sensorPrivacyManager;
|
||||
+ mKeyguardManager = (KeyguardManager) mContext.getSystemService(
|
||||
+ Context.KEYGUARD_SERVICE);
|
||||
+ mActivityStarter = activityStarter;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public BooleanState newTileState() {
|
||||
+ return new BooleanState();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void handleClick() {
|
||||
+ final boolean wasEnabled = mState.value;
|
||||
+ // Don't allow disabling from the lockscreen.
|
||||
+ if (wasEnabled && mKeyguardManager.isKeyguardLocked()) {
|
||||
+ mActivityStarter.postQSRunnableDismissingKeyguard(() -> {
|
||||
+ MetricsLogger.action(mContext, getMetricsCategory(), !wasEnabled);
|
||||
+ setEnabled(!wasEnabled);
|
||||
+ });
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ MetricsLogger.action(mContext, getMetricsCategory(), !wasEnabled);
|
||||
+ setEnabled(!wasEnabled);
|
||||
+ }
|
||||
+
|
||||
+ private void setEnabled(boolean enabled) {
|
||||
+ mSensorPrivacyManager.setSensorPrivacy(enabled);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public CharSequence getTileLabel() {
|
||||
+ return mContext.getString(R.string.sensor_privacy_mode);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Intent getLongClickIntent() {
|
||||
+ return new Intent();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected void handleUpdateState(BooleanState state, Object arg) {
|
||||
+ final boolean enabled = arg instanceof Boolean ? (Boolean) arg
|
||||
+ : mSensorPrivacyManager.isSensorPrivacyEnabled();
|
||||
+ state.value = enabled;
|
||||
+ state.label = mContext.getString(R.string.sensor_privacy_mode);
|
||||
+ state.icon = mIcon;
|
||||
+ state.state = enabled ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE;
|
||||
+ state.contentDescription = state.label;
|
||||
+ state.expandedAccessibilityClassName = Switch.class.getName();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getMetricsCategory() {
|
||||
+ return MetricsEvent.QS_SENSOR_PRIVACY;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected String composeChangeAnnouncement() {
|
||||
+ if (mState.value) {
|
||||
+ return mContext
|
||||
+ .getString(R.string.accessibility_quick_settings_sensor_privacy_changed_on);
|
||||
+ } else {
|
||||
+ return mContext
|
||||
+ .getString(R.string.accessibility_quick_settings_sensor_privacy_changed_off);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected void handleSetListening(boolean listening) {
|
||||
+ if (listening) {
|
||||
+ mSensorPrivacyManager.addSensorPrivacyListener(this);
|
||||
+ } else {
|
||||
+ mSensorPrivacyManager.removeSensorPrivacyListener(this);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onSensorPrivacyChanged(boolean enabled) {
|
||||
+ refreshState(enabled);
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,95 @@
|
||||
From 051e9e895fe14095e3161cb81cd68fe590858750 Mon Sep 17 00:00:00 2001
|
||||
From: Tad <tad@spotco.us>
|
||||
Date: Sun, 26 Sep 2021 14:10:53 -0400
|
||||
Subject: [PATCH] Remove the Sensors Off tile
|
||||
|
||||
Signed-off-by: Tad <tad@spotco.us>
|
||||
Change-Id: Ic1dce1c0fffc3c3f6459c4c85e0a64d480d3315a
|
||||
---
|
||||
AndroidManifest.xml | 11 -----
|
||||
.../development/qstile/DevelopmentTiles.java | 42 -------------------
|
||||
2 files changed, 53 deletions(-)
|
||||
|
||||
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
|
||||
index e4378d6b93..89fc7973a7 100644
|
||||
--- a/AndroidManifest.xml
|
||||
+++ b/AndroidManifest.xml
|
||||
@@ -3079,17 +3079,6 @@
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
- <service
|
||||
- android:name=".development.qstile.DevelopmentTiles$SensorsOff"
|
||||
- android:label="@string/sensors_off_quick_settings_title"
|
||||
- android:icon="@drawable/tile_icon_sensors_off"
|
||||
- android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
|
||||
- android:enabled="false">
|
||||
- <intent-filter>
|
||||
- <action android:name="android.service.quicksettings.action.QS_TILE" />
|
||||
- </intent-filter>
|
||||
- </service>
|
||||
-
|
||||
<activity
|
||||
android:name=".HelpTrampoline"
|
||||
android:exported="true"
|
||||
diff --git a/src/com/android/settings/development/qstile/DevelopmentTiles.java b/src/com/android/settings/development/qstile/DevelopmentTiles.java
|
||||
index bb791abef8..2fdb410150 100644
|
||||
--- a/src/com/android/settings/development/qstile/DevelopmentTiles.java
|
||||
+++ b/src/com/android/settings/development/qstile/DevelopmentTiles.java
|
||||
@@ -20,7 +20,6 @@ import android.app.settings.SettingsEnums;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
-import android.hardware.SensorPrivacyManager;
|
||||
import android.app.KeyguardManager;
|
||||
import android.os.IBinder;
|
||||
import android.os.Parcel;
|
||||
@@ -278,45 +277,4 @@ public abstract class DevelopmentTiles extends TileService {
|
||||
}
|
||||
}
|
||||
}
|
||||
-
|
||||
- /**
|
||||
- * Tile to toggle sensors off to control camera, mic, and sensors managed by the SensorManager.
|
||||
- */
|
||||
- public static class SensorsOff extends DevelopmentTiles {
|
||||
- private Context mContext;
|
||||
- private SensorPrivacyManager mSensorPrivacyManager;
|
||||
- private KeyguardManager mKeyguardManager;
|
||||
- private MetricsFeatureProvider mMetricsFeatureProvider;
|
||||
- private boolean mIsEnabled;
|
||||
-
|
||||
- @Override
|
||||
- public void onCreate() {
|
||||
- super.onCreate();
|
||||
- mContext = getApplicationContext();
|
||||
- mSensorPrivacyManager = (SensorPrivacyManager) mContext.getSystemService(
|
||||
- Context.SENSOR_PRIVACY_SERVICE);
|
||||
- mIsEnabled = mSensorPrivacyManager.isSensorPrivacyEnabled();
|
||||
- mMetricsFeatureProvider = FeatureFactory.getFactory(
|
||||
- mContext).getMetricsFeatureProvider();
|
||||
- mKeyguardManager = (KeyguardManager) mContext.getSystemService(
|
||||
- Context.KEYGUARD_SERVICE);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- protected boolean isEnabled() {
|
||||
- return mIsEnabled;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void setIsEnabled(boolean isEnabled) {
|
||||
- // Don't allow sensors to be reenabled from the lock screen.
|
||||
- if (mIsEnabled && mKeyguardManager.isKeyguardLocked()) {
|
||||
- return;
|
||||
- }
|
||||
- mMetricsFeatureProvider.action(getApplicationContext(), SettingsEnums.QS_SENSOR_PRIVACY,
|
||||
- isEnabled);
|
||||
- mIsEnabled = isEnabled;
|
||||
- mSensorPrivacyManager.setSensorPrivacy(isEnabled);
|
||||
- }
|
||||
- }
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,264 @@
|
||||
From 1c55fb2068f641610d00f1c831a43bf3e65b8348 Mon Sep 17 00:00:00 2001
|
||||
From: Tad <tad@spotco.us>
|
||||
Date: Sun, 26 Sep 2021 14:15:01 -0400
|
||||
Subject: [PATCH] Restore Sensors Off tile
|
||||
|
||||
Was moved to Settings under Developer options in a51ea81f4445
|
||||
|
||||
Signed-off-by: Tad <tad@spotco.us>
|
||||
Change-Id: I043d1c6992595f5f074baea15b47cc5d1f2fac3b
|
||||
---
|
||||
.../res/drawable/ic_signal_sensors.xml | 40 ++++++
|
||||
packages/SystemUI/res/values/config.xml | 2 +-
|
||||
.../systemui/qs/tileimpl/QSFactoryImpl.java | 6 +
|
||||
.../systemui/qs/tiles/SensorPrivacyTile.java | 133 ++++++++++++++++++
|
||||
4 files changed, 180 insertions(+), 1 deletion(-)
|
||||
create mode 100644 packages/SystemUI/res/drawable/ic_signal_sensors.xml
|
||||
create mode 100644 packages/SystemUI/src/com/android/systemui/qs/tiles/SensorPrivacyTile.java
|
||||
|
||||
diff --git a/packages/SystemUI/res/drawable/ic_signal_sensors.xml b/packages/SystemUI/res/drawable/ic_signal_sensors.xml
|
||||
new file mode 100644
|
||||
index 000000000000..b9b3500593a5
|
||||
--- /dev/null
|
||||
+++ b/packages/SystemUI/res/drawable/ic_signal_sensors.xml
|
||||
@@ -0,0 +1,40 @@
|
||||
+<!--
|
||||
+ Copyright (C) 2019 The Android Open Source 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.
|
||||
+-->
|
||||
+
|
||||
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
+ android:width="24dp"
|
||||
+ android:height="24dp"
|
||||
+ android:viewportWidth="24.0"
|
||||
+ android:viewportHeight="24.0"
|
||||
+ android:tint="?android:attr/colorControlNormal">
|
||||
+ <path
|
||||
+ android:pathData="M21.966,2 L2,22"
|
||||
+ android:strokeLineCap="round"
|
||||
+ android:strokeColor="#000000"
|
||||
+ android:fillColor="#00000000"
|
||||
+ android:strokeWidth="1.6521436"
|
||||
+ android:strokeLineJoin="miter"
|
||||
+ android:strokeAlpha="1"/>
|
||||
+ <path
|
||||
+ android:pathData="M0.752,12L4.496,12l2.496,-6.25 2.496,12.5 2.496,-15 2.496,12.5 2.496,-7.5 1.248,3.75h4.992"
|
||||
+ android:strokeLineCap="round"
|
||||
+ android:strokeColor="#000000"
|
||||
+ android:fillColor="#00000000"
|
||||
+ android:strokeWidth="1.25090861"
|
||||
+ android:strokeLineJoin="round"
|
||||
+ android:strokeAlpha="1"/>
|
||||
+</vector>
|
||||
+
|
||||
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
|
||||
index 367fe72d4da7..f10d021e5c50 100644
|
||||
--- a/packages/SystemUI/res/values/config.xml
|
||||
+++ b/packages/SystemUI/res/values/config.xml
|
||||
@@ -114,7 +114,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,screenrecord,reverse,ambient_display,aod,caffeine,heads_up,livedisplay,powershare,profiles,reading_mode,sync,usb_tether,volume_panel,vpn,anti_flicker
|
||||
+ wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,nfc,location,hotspot,inversion,saver,dark,work,cast,night,screenrecord,reverse,ambient_display,aod,caffeine,heads_up,livedisplay,powershare,profiles,reading_mode,sync,usb_tether,volume_panel,vpn,anti_flicker,sensorprivacy
|
||||
</string>
|
||||
|
||||
<!-- The tiles to display in QuickSettings -->
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
|
||||
index 47b9c7bec0d7..66d7b8803570 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
|
||||
@@ -51,6 +51,7 @@ import com.android.systemui.qs.tiles.ProfilesTile;
|
||||
import com.android.systemui.qs.tiles.ReadingModeTile;
|
||||
import com.android.systemui.qs.tiles.RotationLockTile;
|
||||
import com.android.systemui.qs.tiles.ScreenRecordTile;
|
||||
+import com.android.systemui.qs.tiles.SensorPrivacyTile;
|
||||
import com.android.systemui.qs.tiles.SyncTile;
|
||||
import com.android.systemui.qs.tiles.UiModeNightTile;
|
||||
import com.android.systemui.qs.tiles.UsbTetherTile;
|
||||
@@ -89,6 +90,7 @@ public class QSFactoryImpl implements QSFactory {
|
||||
private final Provider<DataSaverTile> mDataSaverTileProvider;
|
||||
private final Provider<NightDisplayTile> mNightDisplayTileProvider;
|
||||
private final Provider<NfcTile> mNfcTileProvider;
|
||||
+ private final Provider<SensorPrivacyTile> mSensorPrivacyTileProvider;
|
||||
private final Provider<GarbageMonitor.MemoryTile> mMemoryTileProvider;
|
||||
private final Provider<UiModeNightTile> mUiModeNightTileProvider;
|
||||
private final Provider<ScreenRecordTile> mScreenRecordTileProvider;
|
||||
@@ -127,6 +129,7 @@ public class QSFactoryImpl implements QSFactory {
|
||||
Provider<DataSaverTile> dataSaverTileProvider,
|
||||
Provider<NightDisplayTile> nightDisplayTileProvider,
|
||||
Provider<NfcTile> nfcTileProvider,
|
||||
+ Provider<SensorPrivacyTile> sensorPrivacyTileProvider,
|
||||
Provider<GarbageMonitor.MemoryTile> memoryTileProvider,
|
||||
Provider<UiModeNightTile> uiModeNightTileProvider,
|
||||
Provider<ScreenRecordTile> screenRecordTileProvider,
|
||||
@@ -161,6 +164,7 @@ public class QSFactoryImpl implements QSFactory {
|
||||
mDataSaverTileProvider = dataSaverTileProvider;
|
||||
mNightDisplayTileProvider = nightDisplayTileProvider;
|
||||
mNfcTileProvider = nfcTileProvider;
|
||||
+ mSensorPrivacyTileProvider = sensorPrivacyTileProvider;
|
||||
mMemoryTileProvider = memoryTileProvider;
|
||||
mUiModeNightTileProvider = uiModeNightTileProvider;
|
||||
mScreenRecordTileProvider = screenRecordTileProvider;
|
||||
@@ -224,6 +228,8 @@ public class QSFactoryImpl implements QSFactory {
|
||||
return mNightDisplayTileProvider.get();
|
||||
case "nfc":
|
||||
return mNfcTileProvider.get();
|
||||
+ case "sensorprivacy":
|
||||
+ return mSensorPrivacyTileProvider.get();
|
||||
case "dark":
|
||||
return mUiModeNightTileProvider.get();
|
||||
case "screenrecord":
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/SensorPrivacyTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/SensorPrivacyTile.java
|
||||
new file mode 100644
|
||||
index 000000000000..941e1d44e145
|
||||
--- /dev/null
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/SensorPrivacyTile.java
|
||||
@@ -0,0 +1,133 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2018 The Android Open Source 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.Context;
|
||||
+import android.content.Intent;
|
||||
+import android.hardware.SensorPrivacyManager;
|
||||
+import android.service.quicksettings.Tile;
|
||||
+import android.widget.Switch;
|
||||
+
|
||||
+import com.android.internal.logging.MetricsLogger;
|
||||
+import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
+import com.android.systemui.R;
|
||||
+import com.android.systemui.plugins.ActivityStarter;
|
||||
+import com.android.systemui.plugins.qs.QSTile.BooleanState;
|
||||
+import com.android.systemui.qs.QSHost;
|
||||
+import com.android.systemui.qs.tileimpl.QSTileImpl;
|
||||
+import android.app.KeyguardManager;
|
||||
+
|
||||
+import javax.inject.Inject;
|
||||
+
|
||||
+/** Quick settings tile: SensorPrivacy mode **/
|
||||
+public class SensorPrivacyTile extends QSTileImpl<BooleanState> implements
|
||||
+ SensorPrivacyManager.OnSensorPrivacyChangedListener {
|
||||
+ private static final String TAG = "SensorPrivacy";
|
||||
+ private final Icon mIcon =
|
||||
+ ResourceIcon.get(R.drawable.ic_signal_sensors);
|
||||
+ private KeyguardManager mKeyguardManager;
|
||||
+ private final SensorPrivacyManager mSensorPrivacyManager;
|
||||
+ private final ActivityStarter mActivityStarter;
|
||||
+
|
||||
+ @Inject
|
||||
+ public SensorPrivacyTile(QSHost host, SensorPrivacyManager sensorPrivacyManager,
|
||||
+ ActivityStarter activityStarter) {
|
||||
+ super(host);
|
||||
+
|
||||
+ mSensorPrivacyManager = sensorPrivacyManager;
|
||||
+ mKeyguardManager = (KeyguardManager) mContext.getSystemService(
|
||||
+ Context.KEYGUARD_SERVICE);
|
||||
+ mActivityStarter = activityStarter;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public BooleanState newTileState() {
|
||||
+ return new BooleanState();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void handleClick() {
|
||||
+ final boolean wasEnabled = mState.value;
|
||||
+ // Don't allow disabling from the lockscreen.
|
||||
+ if (wasEnabled && mKeyguardManager.isKeyguardLocked()) {
|
||||
+ mActivityStarter.postQSRunnableDismissingKeyguard(() -> {
|
||||
+ MetricsLogger.action(mContext, getMetricsCategory(), !wasEnabled);
|
||||
+ setEnabled(!wasEnabled);
|
||||
+ });
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ MetricsLogger.action(mContext, getMetricsCategory(), !wasEnabled);
|
||||
+ setEnabled(!wasEnabled);
|
||||
+ }
|
||||
+
|
||||
+ private void setEnabled(boolean enabled) {
|
||||
+ mSensorPrivacyManager.setSensorPrivacy(enabled);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public CharSequence getTileLabel() {
|
||||
+ return mContext.getString(R.string.sensor_privacy_mode);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Intent getLongClickIntent() {
|
||||
+ return new Intent();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected void handleUpdateState(BooleanState state, Object arg) {
|
||||
+ final boolean enabled = arg instanceof Boolean ? (Boolean) arg
|
||||
+ : mSensorPrivacyManager.isSensorPrivacyEnabled();
|
||||
+ state.value = enabled;
|
||||
+ state.label = mContext.getString(R.string.sensor_privacy_mode);
|
||||
+ state.icon = mIcon;
|
||||
+ state.state = enabled ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE;
|
||||
+ state.contentDescription = state.label;
|
||||
+ state.expandedAccessibilityClassName = Switch.class.getName();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getMetricsCategory() {
|
||||
+ return MetricsEvent.QS_SENSOR_PRIVACY;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected String composeChangeAnnouncement() {
|
||||
+ if (mState.value) {
|
||||
+ return mContext
|
||||
+ .getString(R.string.accessibility_quick_settings_sensor_privacy_changed_on);
|
||||
+ } else {
|
||||
+ return mContext
|
||||
+ .getString(R.string.accessibility_quick_settings_sensor_privacy_changed_off);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected void handleSetListening(boolean listening) {
|
||||
+ if (listening) {
|
||||
+ mSensorPrivacyManager.addSensorPrivacyListener(this);
|
||||
+ } else {
|
||||
+ mSensorPrivacyManager.removeSensorPrivacyListener(this);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onSensorPrivacyChanged(boolean enabled) {
|
||||
+ refreshState(enabled);
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,99 @@
|
||||
From e0e9afa0b76af1692cfcb1f24e3ca4f4faccf321 Mon Sep 17 00:00:00 2001
|
||||
From: Tad <tad@spotco.us>
|
||||
Date: Sun, 26 Sep 2021 14:10:53 -0400
|
||||
Subject: [PATCH] Remove the Sensors Off tile
|
||||
|
||||
Signed-off-by: Tad <tad@spotco.us>
|
||||
Change-Id: Ic1dce1c0fffc3c3f6459c4c85e0a64d480d3315a
|
||||
---
|
||||
AndroidManifest.xml | 13 ------
|
||||
.../development/qstile/DevelopmentTiles.java | 42 -------------------
|
||||
2 files changed, 55 deletions(-)
|
||||
|
||||
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
|
||||
index c17807bd13..09d4c3b0ab 100644
|
||||
--- a/AndroidManifest.xml
|
||||
+++ b/AndroidManifest.xml
|
||||
@@ -3130,19 +3130,6 @@
|
||||
android:value="true"/>
|
||||
</service>
|
||||
|
||||
- <service
|
||||
- android:name=".development.qstile.DevelopmentTiles$SensorsOff"
|
||||
- android:label="@string/sensors_off_quick_settings_title"
|
||||
- android:icon="@drawable/tile_icon_sensors_off"
|
||||
- android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
|
||||
- android:enabled="false">
|
||||
- <intent-filter>
|
||||
- <action android:name="android.service.quicksettings.action.QS_TILE" />
|
||||
- </intent-filter>
|
||||
- <meta-data android:name="android.service.quicksettings.TOGGLEABLE_TILE"
|
||||
- android:value="true"/>
|
||||
- </service>
|
||||
-
|
||||
<service
|
||||
android:name=".development.qstile.DevelopmentTiles$WirelessDebugging"
|
||||
android:label="@string/enable_adb_wireless"
|
||||
diff --git a/src/com/android/settings/development/qstile/DevelopmentTiles.java b/src/com/android/settings/development/qstile/DevelopmentTiles.java
|
||||
index 916c6c9291..fd92d17a60 100644
|
||||
--- a/src/com/android/settings/development/qstile/DevelopmentTiles.java
|
||||
+++ b/src/com/android/settings/development/qstile/DevelopmentTiles.java
|
||||
@@ -26,7 +26,6 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.database.ContentObserver;
|
||||
-import android.hardware.SensorPrivacyManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
@@ -319,47 +318,6 @@ public abstract class DevelopmentTiles extends TileService {
|
||||
}
|
||||
}
|
||||
|
||||
- /**
|
||||
- * Tile to toggle sensors off to control camera, mic, and sensors managed by the SensorManager.
|
||||
- */
|
||||
- public static class SensorsOff extends DevelopmentTiles {
|
||||
- private Context mContext;
|
||||
- private SensorPrivacyManager mSensorPrivacyManager;
|
||||
- private KeyguardManager mKeyguardManager;
|
||||
- private MetricsFeatureProvider mMetricsFeatureProvider;
|
||||
- private boolean mIsEnabled;
|
||||
-
|
||||
- @Override
|
||||
- public void onCreate() {
|
||||
- super.onCreate();
|
||||
- mContext = getApplicationContext();
|
||||
- mSensorPrivacyManager = (SensorPrivacyManager) mContext.getSystemService(
|
||||
- Context.SENSOR_PRIVACY_SERVICE);
|
||||
- mIsEnabled = mSensorPrivacyManager.isSensorPrivacyEnabled();
|
||||
- mMetricsFeatureProvider = FeatureFactory.getFactory(
|
||||
- mContext).getMetricsFeatureProvider();
|
||||
- mKeyguardManager = (KeyguardManager) mContext.getSystemService(
|
||||
- Context.KEYGUARD_SERVICE);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- protected boolean isEnabled() {
|
||||
- return mIsEnabled;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void setIsEnabled(boolean isEnabled) {
|
||||
- // Don't allow sensors to be reenabled from the lock screen.
|
||||
- if (mIsEnabled && mKeyguardManager.isKeyguardLocked()) {
|
||||
- return;
|
||||
- }
|
||||
- mMetricsFeatureProvider.action(getApplicationContext(), SettingsEnums.QS_SENSOR_PRIVACY,
|
||||
- isEnabled);
|
||||
- mIsEnabled = isEnabled;
|
||||
- mSensorPrivacyManager.setSensorPrivacy(isEnabled);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
/**
|
||||
* Tile to control the "Wireless debugging" developer setting
|
||||
*/
|
||||
--
|
||||
2.31.1
|
||||
|
@ -115,6 +115,7 @@ if [ "$DOS_GRAPHENE_EXEC" = true ]; then patch -p1 < "$DOS_PATCHES/android_frame
|
||||
patch -p1 < "$DOS_PATCHES/android_frameworks_base/0003-SUPL_No_IMSI.patch"; #Don't send IMSI to SUPL (MSe1969)
|
||||
patch -p1 < "$DOS_PATCHES/android_frameworks_base/0004-Fingerprint_Lockout.patch"; #Enable fingerprint lockout after three failed attempts (GrapheneOS)
|
||||
patch -p1 < "$DOS_PATCHES/android_frameworks_base/0011-Sensors.patch"; #Permission for sensors access (MSe1969)
|
||||
patch -p1 < "$DOS_PATCHES/android_frameworks_base/0012-Restore_SensorsOff.patch"; #Restore the Sensors Off tile
|
||||
if [ "$DOS_MICROG_INCLUDED" != "FULL" ]; then rm -rf packages/CompanionDeviceManager; fi; #Used to support Android Wear (which hard depends on GMS)
|
||||
#sed -i '295i\ if(packageList != null && packageList.size() > 0) { packageList.add("net.sourceforge.opencamera"); }' core/java/android/hardware/Camera.java; #Add Open Camera to aux camera allowlist XXX: needs testing, broke boot last time
|
||||
rm -rf packages/OsuLogin; #Automatic Wi-Fi connection non-sense
|
||||
@ -200,6 +201,7 @@ if enterAndClear "packages/apps/Settings"; then
|
||||
git revert --no-edit 486980cfecce2ca64267f41462f9371486308e9d; #Don't hide OEM unlock
|
||||
patch -p1 < "$DOS_PATCHES/android_packages_apps_Settings/0001-Captive_Portal_Toggle.patch"; #Add option to disable captive portal checks (MSe1969)
|
||||
patch -p1 < "$DOS_PATCHES/android_packages_apps_Settings/0002-Sensors.patch"; #Permission for sensors access (MSe1969)
|
||||
patch -p1 < "$DOS_PATCHES/android_packages_apps_Settings/0003-Remove_SensorsOff_Tile.patch"; #Remove the Sensors Off development tile
|
||||
sed -i 's/private int mPasswordMaxLength = 16;/private int mPasswordMaxLength = 48;/' src/com/android/settings/password/ChooseLockPassword.java; #Increase max password length (GrapheneOS)
|
||||
sed -i 's/if (isFullDiskEncrypted()) {/if (false) {/' src/com/android/settings/accessibility/*AccessibilityService*.java; #Never disable secure start-up when enabling an accessibility service
|
||||
if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then sed -i 's/GSETTINGS_PROVIDER = "com.google.settings";/GSETTINGS_PROVIDER = "com.google.oQuae4av";/' src/com/android/settings/backup/PrivacySettingsUtils.java; fi; #microG doesn't support Backup, hide the options
|
||||
|
@ -97,6 +97,7 @@ patch -p1 < "$DOS_PATCHES/android_frameworks_base/0009-SystemUI_No_Permission_Re
|
||||
patch -p1 < "$DOS_PATCHES/android_frameworks_base/0003-SUPL_No_IMSI.patch"; #Don't send IMSI to SUPL (MSe1969)
|
||||
patch -p1 < "$DOS_PATCHES/android_frameworks_base/0004-Fingerprint_Lockout.patch"; #Enable fingerprint lockout after three failed attempts (GrapheneOS)
|
||||
patch -p1 < "$DOS_PATCHES/android_frameworks_base/0010-Sensors.patch"; #Permission for sensors access (MSe1969)
|
||||
patch -p1 < "$DOS_PATCHES/android_frameworks_base/0011-Restore_SensorsOff.patch"; #Restore the Sensors Off tile
|
||||
#sed -i '301i\ if(packageList != null && packageList.size() > 0) { packageList.add("net.sourceforge.opencamera"); }' core/java/android/hardware/Camera.java; #Add Open Camera to aux camera allowlist XXX: needs testing, broke boot last time
|
||||
if [ "$DOS_MICROG_INCLUDED" != "FULL" ]; then rm -rf packages/CompanionDeviceManager; fi; #Used to support Android Wear (which hard depends on GMS)
|
||||
rm -rf packages/PrintRecommendationService; #Creates popups to install proprietary print apps
|
||||
@ -187,6 +188,7 @@ fi;
|
||||
if enterAndClear "packages/apps/Settings"; then
|
||||
patch -p1 < "$DOS_PATCHES/android_packages_apps_Settings/0001-Captive_Portal_Toggle.patch"; #Add option to disable captive portal checks (MSe1969)
|
||||
patch -p1 < "$DOS_PATCHES/android_packages_apps_Settings/0002-Sensors.patch"; #Permission for sensors access (MSe1969)
|
||||
patch -p1 < "$DOS_PATCHES/android_packages_apps_Settings/0003-Remove_SensorsOff_Tile.patch"; #Remove the Sensors Off development tile
|
||||
sed -i 's/if (isFullDiskEncrypted()) {/if (false) {/' src/com/android/settings/accessibility/*AccessibilityService*.java; #Never disable secure start-up when enabling an accessibility service
|
||||
if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then sed -i 's/GSETTINGS_PROVIDER = "com.google.settings";/GSETTINGS_PROVIDER = "com.google.oQuae4av";/' src/com/android/settings/backup/PrivacySettingsUtils.java; fi; #microG doesn't support Backup, hide the options
|
||||
fi;
|
||||
|
Loading…
Reference in New Issue
Block a user