ParanoidSystemUI: Require unlocking to use sensitive QS tiles

- Bluetooth Dialog
- Cellular
- Wi-Fi

Change-Id: I6c6969d952c4dc6fac0fa3188896ed3b9461439a
Signed-off-by: Omkar Chandorkar <gotenksIN@aospa.co>
This commit is contained in:
Danny Lin 2023-06-08 18:29:49 +09:00 committed by Omkar Chandorkar
parent 77ce584814
commit 42fcbcf38e
No known key found for this signature in database
3 changed files with 27 additions and 10 deletions

View File

@ -40,6 +40,7 @@ import com.android.systemui.qs.QSHost;
import com.android.systemui.qs.logging.QSLogger;
import com.android.systemui.qs.tiles.BluetoothTile;
import com.android.systemui.statusbar.policy.BluetoothController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import co.aospa.systemui.qs.tiles.dialog.BluetoothDialogFactory;
@ -63,10 +64,11 @@ public class BluetoothDialogTile extends BluetoothTile {
ActivityStarter activityStarter,
QSLogger qsLogger,
BluetoothController bluetoothController,
BluetoothDialogFactory bluetoothDialogFactory
BluetoothDialogFactory bluetoothDialogFactory,
KeyguardStateController keyguardStateController
) {
super(host, backgroundLooper, mainHandler, falsingManager, metricsLogger,
statusBarStateController, activityStarter, qsLogger, bluetoothController);
statusBarStateController, activityStarter, qsLogger, bluetoothController, keyguardStateController);
mHandler = mainHandler;
mBluetoothDialogFactory = bluetoothDialogFactory;
}
@ -79,7 +81,10 @@ public class BluetoothDialogTile extends BluetoothTile {
}
@Override
protected void handleClick(@Nullable View view) {
protected void handleClick(@Nullable View view, boolean keyguardShowing) {
if (checkKeyguard(view, keyguardShowing)) {
return;
}
mHandler.post(() -> mBluetoothDialogFactory.create(true, view));
}
}

View File

@ -54,6 +54,7 @@ import com.android.systemui.qs.QSHost;
import com.android.systemui.qs.SignalTileView;
import com.android.systemui.qs.logging.QSLogger;
import com.android.systemui.qs.tileimpl.QSTileImpl;
import com.android.systemui.qs.tiles.SecureQSTile;
import com.android.systemui.statusbar.connectivity.IconState;
import com.android.systemui.statusbar.connectivity.MobileDataIndicators;
import com.android.systemui.statusbar.connectivity.NetworkController;
@ -64,7 +65,7 @@ import com.android.systemui.statusbar.policy.KeyguardStateController;
import javax.inject.Inject;
/** Quick settings tile: Cellular **/
public class CellularTile extends QSTileImpl<SignalState> {
public class CellularTile extends SecureQSTile<SignalState> {
public static final String TILE_SPEC = "cell";
@ -90,7 +91,7 @@ public class CellularTile extends QSTileImpl<SignalState> {
) {
super(host, backgroundLooper, mainHandler, falsingManager, metricsLogger,
statusBarStateController, activityStarter, qsLogger);
statusBarStateController, activityStarter, qsLogger, keyguardStateController);
mController = networkController;
mKeyguard = keyguardStateController;
mDataController = mController.getMobileDataController();
@ -116,7 +117,11 @@ public class CellularTile extends QSTileImpl<SignalState> {
}
@Override
protected void handleClick(@Nullable View view) {
protected void handleClick(@Nullable View view, boolean keyguardShowing) {
if (checkKeyguard(view, keyguardShowing)) {
return;
}
if (getState().state == Tile.STATE_UNAVAILABLE) {
return;
}

View File

@ -48,16 +48,18 @@ import com.android.systemui.qs.QSHost;
import com.android.systemui.qs.logging.QSLogger;
import com.android.systemui.qs.tileimpl.QSIconViewImpl;
import com.android.systemui.qs.tileimpl.QSTileImpl;
import com.android.systemui.qs.tiles.SecureQSTile;
import com.android.systemui.statusbar.connectivity.AccessPointController;
import com.android.systemui.statusbar.connectivity.NetworkController;
import com.android.systemui.statusbar.connectivity.SignalCallback;
import com.android.systemui.statusbar.connectivity.WifiIcons;
import com.android.systemui.statusbar.connectivity.WifiIndicators;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import javax.inject.Inject;
/** Quick settings tile: Wifi **/
public class WifiTile extends QSTileImpl<SignalState> {
public class WifiTile extends SecureQSTile<SignalState> {
public static final String TILE_SPEC = "wifi";
@ -81,10 +83,11 @@ public class WifiTile extends QSTileImpl<SignalState> {
ActivityStarter activityStarter,
QSLogger qsLogger,
NetworkController networkController,
AccessPointController accessPointController
AccessPointController accessPointController,
KeyguardStateController keyguardStateController
) {
super(host, backgroundLooper, mainHandler, falsingManager, metricsLogger,
statusBarStateController, activityStarter, qsLogger);
statusBarStateController, activityStarter, qsLogger, keyguardStateController);
mController = networkController;
mWifiController = accessPointController;
mController.observe(getLifecycle(), mSignalCallback);
@ -107,7 +110,11 @@ public class WifiTile extends QSTileImpl<SignalState> {
}
@Override
protected void handleClick(@Nullable View view) {
protected void handleClick(@Nullable View view, boolean keyguardShowing) {
if (checkKeyguard(view, keyguardShowing)) {
return;
}
// Secondary clicks are header clicks, just toggle.
mState.copyTo(mStateBeforeClick);
boolean wifiEnabled = mState.value;