From 999f98feb72ce1ffda94a964be7fce0dc4a6d746 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Mon, 11 Apr 2022 21:16:42 +0000 Subject: SystemUI: remove unused code that showed radio status in CryptKeeper mode Since support for Full Disk Encryption was removed in favor of File Based Encryption, "CryptKeeper mode" no longer exists and the "vold.decrypt" system property is never set. Therefore, remove the unused SystemUI code that showed the radio status in CryptKeeper mode. This is, very roughly, a revert of ag/1350315 which added this feature in 2016. However, the code has changed a bit since then. As discussed with Eric, I'm cherry picking this CL in master to tm-qpr-dev to mitigate a merge conflicts in a CL of mine and also to prevent the two branches from diverging. Bug: 208476087 Test: mp droid Change-Id: I6231762e8353113366eba92b686d6d61582fb2b7 Merged-In: I6231762e8353113366eba92b686d6d61582fb2b7 --- .../statusbar/connectivity/NetworkController.java | 2 - .../connectivity/NetworkControllerImpl.java | 6 - .../phone/dagger/StatusBarViewModule.java | 3 - .../phone/fragment/CollapsedStatusBarFragment.java | 41 ------ .../statusbar/policy/EmergencyCryptkeeperText.java | 147 --------------------- .../statusbar/policy/EncryptionHelper.java | 32 ----- 6 files changed, 231 deletions(-) delete mode 100644 packages/SystemUI/src/com/android/systemui/statusbar/policy/EmergencyCryptkeeperText.java delete mode 100644 packages/SystemUI/src/com/android/systemui/statusbar/policy/EncryptionHelper.java (limited to 'packages/SystemUI/src') diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/NetworkController.java index f960eb7b6e9b..ed32008526d8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/NetworkController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/NetworkController.java @@ -47,8 +47,6 @@ public interface NetworkController extends CallbackController, D void addEmergencyListener(EmergencyListener listener); /** */ void removeEmergencyListener(EmergencyListener listener); - /** */ - boolean hasEmergencyCryptKeeperText(); /** */ boolean isRadioOn(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/NetworkControllerImpl.java index 5f5418f5eeb9..6e74542691a5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/NetworkControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/NetworkControllerImpl.java @@ -84,7 +84,6 @@ import com.android.systemui.statusbar.policy.DataSaverController; import com.android.systemui.statusbar.policy.DataSaverControllerImpl; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener; -import com.android.systemui.statusbar.policy.EncryptionHelper; import com.android.systemui.telephony.TelephonyListenerManager; import com.android.systemui.util.CarrierConfigTracker; @@ -1485,11 +1484,6 @@ public class NetworkControllerImpl extends BroadcastReceiver return info; } - /** */ - public boolean hasEmergencyCryptKeeperText() { - return EncryptionHelper.IS_DATA_ENCRYPTED; - } - /** */ public boolean isRadioOn() { return !mAirplaneMode; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java index 206c0aa0d7a4..344d23341dc1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java @@ -46,7 +46,6 @@ import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.NotificationShelf; import com.android.systemui.statusbar.NotificationShelfController; import com.android.systemui.statusbar.OperatorNameViewController; -import com.android.systemui.statusbar.connectivity.NetworkController; import com.android.systemui.statusbar.core.StatusBarInitializer.OnStatusBarViewInitializedListener; import com.android.systemui.statusbar.events.SystemStatusAnimationScheduler; import com.android.systemui.statusbar.notification.row.dagger.NotificationShelfComponent; @@ -293,7 +292,6 @@ public abstract class StatusBarViewModule { StatusBarHideIconsForBouncerManager statusBarHideIconsForBouncerManager, KeyguardStateController keyguardStateController, NotificationPanelViewController notificationPanelViewController, - NetworkController networkController, StatusBarStateController statusBarStateController, CommandQueue commandQueue, CarrierConfigTracker carrierConfigTracker, @@ -315,7 +313,6 @@ public abstract class StatusBarViewModule { statusBarHideIconsForBouncerManager, keyguardStateController, notificationPanelViewController, - networkController, statusBarStateController, commandQueue, carrierConfigTracker, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java index be6d5baf8eda..9354c5e1948d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java @@ -24,7 +24,6 @@ import static com.android.systemui.statusbar.events.SystemStatusAnimationSchedul import static com.android.systemui.statusbar.events.SystemStatusAnimationSchedulerKt.SHOWING_PERSISTENT_DOT; import android.animation.Animator; -import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SuppressLint; import android.app.Fragment; @@ -59,9 +58,6 @@ import com.android.systemui.statusbar.DisableFlagsLogger.DisableState; import com.android.systemui.statusbar.OperatorNameView; import com.android.systemui.statusbar.OperatorNameViewController; import com.android.systemui.statusbar.StatusBarState; -import com.android.systemui.statusbar.connectivity.IconState; -import com.android.systemui.statusbar.connectivity.NetworkController; -import com.android.systemui.statusbar.connectivity.SignalCallback; import com.android.systemui.statusbar.events.SystemStatusAnimationCallback; import com.android.systemui.statusbar.events.SystemStatusAnimationScheduler; import com.android.systemui.statusbar.phone.NotificationIconAreaController; @@ -75,7 +71,6 @@ import com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentCom import com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent.Startable; import com.android.systemui.statusbar.phone.ongoingcall.OngoingCallController; import com.android.systemui.statusbar.phone.ongoingcall.OngoingCallListener; -import com.android.systemui.statusbar.policy.EncryptionHelper; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.util.CarrierConfigTracker; import com.android.systemui.util.CarrierConfigTracker.CarrierConfigChangedListener; @@ -110,7 +105,6 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue private final StatusBarStateController mStatusBarStateController; private final KeyguardStateController mKeyguardStateController; private final NotificationPanelViewController mNotificationPanelViewController; - private final NetworkController mNetworkController; private LinearLayout mEndSideContent; private View mClockView; private View mOngoingCallChip; @@ -139,13 +133,6 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue private List mBlockedIcons = new ArrayList<>(); private Map mStartableStates = new ArrayMap<>(); - private SignalCallback mSignalCallback = new SignalCallback() { - @Override - public void setIsAirplaneMode(@NonNull IconState icon) { - mCommandQueue.recomputeDisableFlags(getContext().getDisplayId(), true /* animate */); - } - }; - private final OngoingCallListener mOngoingCallListener = new OngoingCallListener() { @Override public void onOngoingCallStateChanged(boolean animate) { @@ -191,7 +178,6 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue StatusBarHideIconsForBouncerManager statusBarHideIconsForBouncerManager, KeyguardStateController keyguardStateController, NotificationPanelViewController notificationPanelViewController, - NetworkController networkController, StatusBarStateController statusBarStateController, CommandQueue commandQueue, CarrierConfigTracker carrierConfigTracker, @@ -213,7 +199,6 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue mDarkIconManagerFactory = darkIconManagerFactory; mKeyguardStateController = keyguardStateController; mNotificationPanelViewController = notificationPanelViewController; - mNetworkController = networkController; mStatusBarStateController = statusBarStateController; mCommandQueue = commandQueue; mCarrierConfigTracker = carrierConfigTracker; @@ -261,7 +246,6 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue mOngoingCallChip = mStatusBar.findViewById(R.id.ongoing_call_chip); showEndSideContent(false); showClock(false); - initEmergencyCryptkeeperText(); initOperatorName(); initNotificationIconArea(); mSystemEventAnimator = @@ -340,9 +324,6 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue public void onDestroyView() { super.onDestroyView(); mStatusBarIconController.removeIconGroup(mDarkIconManager); - if (mNetworkController.hasEmergencyCryptKeeperText()) { - mNetworkController.removeCallback(mSignalCallback); - } mCarrierConfigTracker.removeCallback(mCarrierConfigCallback); mCarrierConfigTracker.removeDataSubscriptionChangedListener(mDefaultDataListener); @@ -444,15 +425,6 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue state |= DISABLE_CLOCK; } - if (mNetworkController != null && EncryptionHelper.IS_DATA_ENCRYPTED) { - if (mNetworkController.hasEmergencyCryptKeeperText()) { - state |= DISABLE_NOTIFICATION_ICONS; - } - if (!mNetworkController.isRadioOn()) { - state |= DISABLE_SYSTEM_INFO; - } - } - if (mOngoingCallController.hasOngoingCall()) { state &= ~DISABLE_ONGOING_CALL_CHIP; } else { @@ -620,19 +592,6 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue } } - private void initEmergencyCryptkeeperText() { - View emergencyViewStub = mStatusBar.findViewById(R.id.emergency_cryptkeeper_text); - if (mNetworkController.hasEmergencyCryptKeeperText()) { - if (emergencyViewStub != null) { - ((ViewStub) emergencyViewStub).inflate(); - } - mNetworkController.addCallback(mSignalCallback); - } else if (emergencyViewStub != null) { - ViewGroup parent = (ViewGroup) emergencyViewStub.getParent(); - parent.removeView(emergencyViewStub); - } - } - private void initOperatorName() { int subId = SubscriptionManager.getDefaultDataSubscriptionId(); if (mCarrierConfigTracker.getShowOperatorNameInStatusBarConfig(subId)) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/EmergencyCryptkeeperText.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/EmergencyCryptkeeperText.java deleted file mode 100644 index 21a83004ba84..000000000000 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/EmergencyCryptkeeperText.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (C) 2016 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.statusbar.policy; - -import android.annotation.Nullable; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.provider.Settings; -import android.telephony.SubscriptionInfo; -import android.telephony.TelephonyManager; -import android.text.TextUtils; -import android.util.AttributeSet; -import android.widget.TextView; - -import com.android.keyguard.KeyguardUpdateMonitor; -import com.android.keyguard.KeyguardUpdateMonitorCallback; -import com.android.systemui.Dependency; - -import java.util.List; - -public class EmergencyCryptkeeperText extends TextView { - - private KeyguardUpdateMonitor mKeyguardUpdateMonitor; - private final KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() { - @Override - public void onPhoneStateChanged(int phoneState) { - update(); - } - - @Override - public void onRefreshCarrierInfo() { - update(); - } - }; - private final BroadcastReceiver mReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - if (Intent.ACTION_AIRPLANE_MODE_CHANGED.equals(intent.getAction())) { - update(); - } - } - }; - - public EmergencyCryptkeeperText(Context context, @Nullable AttributeSet attrs) { - super(context, attrs); - setVisibility(GONE); - } - - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - mKeyguardUpdateMonitor = Dependency.get(KeyguardUpdateMonitor.class); - mKeyguardUpdateMonitor.registerCallback(mCallback); - getContext().registerReceiver(mReceiver, - new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED)); - update(); - } - - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - if (mKeyguardUpdateMonitor != null) { - mKeyguardUpdateMonitor.removeCallback(mCallback); - } - getContext().unregisterReceiver(mReceiver); - } - - private boolean iccCardExist(int simState) { - return ((simState == TelephonyManager.SIM_STATE_PIN_REQUIRED) - || (simState == TelephonyManager.SIM_STATE_PUK_REQUIRED) - || (simState == TelephonyManager.SIM_STATE_NETWORK_LOCKED) - || (simState == TelephonyManager.SIM_STATE_READY) - || (simState == TelephonyManager.SIM_STATE_NOT_READY) - || (simState == TelephonyManager.SIM_STATE_PERM_DISABLED) - || (simState == TelephonyManager.SIM_STATE_CARD_IO_ERROR) - || (simState == TelephonyManager.SIM_STATE_CARD_RESTRICTED) - || (simState == TelephonyManager.SIM_STATE_LOADED)); - } - - public void update() { - boolean hasMobile = mContext.getSystemService(TelephonyManager.class).isDataCapable(); - boolean airplaneMode = (Settings.Global.getInt(mContext.getContentResolver(), - Settings.Global.AIRPLANE_MODE_ON, 0) == 1); - - if (!hasMobile || airplaneMode) { - setText(null); - setVisibility(GONE); - return; - } - - boolean allSimsMissing = true; - CharSequence displayText = null; - - List subs = mKeyguardUpdateMonitor.getFilteredSubscriptionInfo(); - final int N = subs.size(); - for (int i = 0; i < N; i++) { - int subId = subs.get(i).getSubscriptionId(); - int simState = mKeyguardUpdateMonitor.getSimState(subId); - CharSequence carrierName = subs.get(i).getCarrierName(); - if (iccCardExist(simState) && !TextUtils.isEmpty(carrierName)) { - allSimsMissing = false; - displayText = carrierName; - } - } - if (allSimsMissing) { - if (N != 0) { - // Shows "Emergency calls only" on devices that are voice-capable. - // This depends on mPlmn containing the text "Emergency calls only" when the radio - // has some connectivity. Otherwise it should show "No service" - // Grab the first subscription, because they all should contain the emergency text, - // described above. - displayText = subs.get(0).getCarrierName(); - } else { - // We don't have a SubscriptionInfo to get the emergency calls only from. - // Grab it from the old sticky broadcast if possible instead. We can use it - // here because no subscriptions are active, so we don't have - // to worry about MSIM clashing. - displayText = getContext().getText( - com.android.internal.R.string.emergency_calls_only); - Intent i = getContext().registerReceiver(null, - new IntentFilter(TelephonyManager.ACTION_SERVICE_PROVIDERS_UPDATED)); - if (i != null) { - displayText = i.getStringExtra(TelephonyManager.EXTRA_PLMN); - } - } - } - - setText(displayText); - setVisibility(TextUtils.isEmpty(displayText) ? GONE : VISIBLE); - } -} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/EncryptionHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/EncryptionHelper.java deleted file mode 100644 index 9c099f91bc8d..000000000000 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/EncryptionHelper.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2016 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.statusbar.policy; - -import android.sysprop.VoldProperties; - -/** - * Helper for determining whether the phone is decrypted yet. - */ -public class EncryptionHelper { - - public static final boolean IS_DATA_ENCRYPTED = isDataEncrypted(); - - private static boolean isDataEncrypted() { - String voldState = VoldProperties.decrypt().orElse(""); - return "1".equals(voldState) || "trigger_restart_min_framework".equals(voldState); - } -} -- cgit v1.2.3-59-g8ed1b