diff options
Diffstat (limited to 'packages/SystemUI/src')
33 files changed, 203 insertions, 181 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java index 76adf04b21e7..1f22d48561f2 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java @@ -141,7 +141,7 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView { // Sending empty PIN here to query the number of remaining PIN attempts new CheckSimPin("", mSubId) { void onSimCheckResponse(final PinResult result) { - Log.d(LOG_TAG, "onSimCheckResponse " + " dummy One result " + Log.d(LOG_TAG, "onSimCheckResponse " + " empty One result " + result.toString()); if (result.getAttemptsRemaining() >= 0) { mRemainingAttempts = result.getAttemptsRemaining(); @@ -257,31 +257,16 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView { @Override public void run() { if (DEBUG) { - Log.v(TAG, "call supplyPinReportResultForSubscriber(subid=" + mSubId + ")"); + Log.v(TAG, "call supplyIccLockPin(subid=" + mSubId + ")"); } TelephonyManager telephonyManager = ((TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE)) .createForSubscriptionId(mSubId); - final PinResult result = telephonyManager.supplyPinReportPinResult(mPin); - if (result == null) { - Log.e(TAG, "Error result for supplyPinReportResult."); - post(new Runnable() { - @Override - public void run() { - onSimCheckResponse(PinResult.getDefaultFailedResult()); - } - }); - } else { - if (DEBUG) { - Log.v(TAG, "supplyPinReportResult returned: " + result.toString()); - } - post(new Runnable() { - @Override - public void run() { - onSimCheckResponse(result); - } - }); + final PinResult result = telephonyManager.supplyIccLockPin(mPin); + if (DEBUG) { + Log.v(TAG, "supplyIccLockPin returned: " + result.toString()); } + post(() -> onSimCheckResponse(result)); } } @@ -341,8 +326,8 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView { } resetPasswordText(true /* animate */, /* announce */ - result.getType() != PinResult.PIN_RESULT_TYPE_SUCCESS); - if (result.getType() == PinResult.PIN_RESULT_TYPE_SUCCESS) { + result.getResult() != PinResult.PIN_RESULT_TYPE_SUCCESS); + if (result.getResult() == PinResult.PIN_RESULT_TYPE_SUCCESS) { Dependency.get(KeyguardUpdateMonitor.class) .reportSimUnlocked(mSubId); mRemainingAttempts = -1; @@ -352,7 +337,7 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView { } } else { mShowDefaultMessage = false; - if (result.getType() == PinResult.PIN_RESULT_TYPE_INCORRECT) { + if (result.getResult() == PinResult.PIN_RESULT_TYPE_INCORRECT) { if (result.getAttemptsRemaining() <= 2) { // this is getting critical - show dialog getSimRemainingAttemptsDialog( diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java index a84664ceee3d..31fc760d24d8 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java @@ -195,7 +195,7 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView { void onSimLockChangedResponse(final PinResult result) { if (result == null) Log.e(LOG_TAG, "onSimCheckResponse, pin result is NULL"); else { - Log.d(LOG_TAG, "onSimCheckResponse " + " dummy One result " + Log.d(LOG_TAG, "onSimCheckResponse " + " empty One result " + result.toString()); if (result.getAttemptsRemaining() >= 0) { mRemainingAttempts = result.getAttemptsRemaining(); @@ -319,30 +319,17 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView { @Override public void run() { - if (DEBUG) Log.v(TAG, "call supplyPukReportResult()"); + if (DEBUG) { + Log.v(TAG, "call supplyIccLockPuk(subid=" + mSubId + ")"); + } TelephonyManager telephonyManager = ((TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE)) .createForSubscriptionId(mSubId); - final PinResult result = telephonyManager.supplyPukReportPinResult(mPuk, mPin); - if (result == null) { - Log.e(TAG, "Error result for supplyPukReportResult."); - post(new Runnable() { - @Override - public void run() { - onSimLockChangedResponse(PinResult.getDefaultFailedResult()); - } - }); - } else { - if (DEBUG) { - Log.v(TAG, "supplyPukReportResult returned: " + result.toString()); - } - post(new Runnable() { - @Override - public void run() { - onSimLockChangedResponse(result); - } - }); + final PinResult result = telephonyManager.supplyIccLockPuk(mPuk, mPin); + if (DEBUG) { + Log.v(TAG, "supplyIccLockPuk returned: " + result.toString()); } + post(() -> onSimLockChangedResponse(result)); } } @@ -415,8 +402,8 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView { } resetPasswordText(true /* animate */, /* announce */ - result.getType() != PinResult.PIN_RESULT_TYPE_SUCCESS); - if (result.getType() == PinResult.PIN_RESULT_TYPE_SUCCESS) { + result.getResult() != PinResult.PIN_RESULT_TYPE_SUCCESS); + if (result.getResult() == PinResult.PIN_RESULT_TYPE_SUCCESS) { Dependency.get(KeyguardUpdateMonitor.class) .reportSimUnlocked(mSubId); mRemainingAttempts = -1; @@ -427,7 +414,7 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView { } } else { mShowDefaultMessage = false; - if (result.getType() == PinResult.PIN_RESULT_TYPE_INCORRECT) { + if (result.getResult() == PinResult.PIN_RESULT_TYPE_INCORRECT) { // show message mSecurityMessageDisplay.setMessage(getPukPasswordErrorMessage( result.getAttemptsRemaining(), false)); diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index 60541eb56afc..60cd24019b97 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -2579,6 +2579,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab return true; } + // change in battery overheat + if (current.health != old.health) { + return true; + } + return false; } diff --git a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java index a46ab3a9e35b..5235a451d021 100644 --- a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java +++ b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java @@ -234,7 +234,7 @@ public class BatteryMeterView extends LinearLayout implements } Dependency.get(TunerService.class) - .addTunable(this, StatusBarIconController.ICON_BLACKLIST); + .addTunable(this, StatusBarIconController.ICON_HIDE_LIST); mIsSubscribedForTunerUpdates = true; } @@ -287,8 +287,8 @@ public class BatteryMeterView extends LinearLayout implements @Override public void onTuningChanged(String key, String newValue) { - if (StatusBarIconController.ICON_BLACKLIST.equals(key)) { - ArraySet<String> icons = StatusBarIconController.getIconBlacklist( + if (StatusBarIconController.ICON_HIDE_LIST.equals(key)) { + ArraySet<String> icons = StatusBarIconController.getIconHideList( getContext(), newValue); setVisibility(icons.contains(mSlotBattery) ? View.GONE : View.VISIBLE); } diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java index ded129defe07..097beba32bdf 100644 --- a/packages/SystemUI/src/com/android/systemui/Dependency.java +++ b/packages/SystemUI/src/com/android/systemui/Dependency.java @@ -128,6 +128,7 @@ import com.android.systemui.wm.DisplayController; import com.android.systemui.wm.DisplayImeController; import com.android.systemui.wm.SystemWindows; +import java.util.concurrent.Executor; import java.util.function.Consumer; import javax.inject.Inject; @@ -169,6 +170,15 @@ public class Dependency { * Generic handler on the main thread. */ private static final String MAIN_HANDLER_NAME = "main_handler"; + /** + * Generic executor on the main thread. + */ + private static final String MAIN_EXECUTOR_NAME = "main_executor"; + + /** + * Generic executor on a background thread. + */ + private static final String BACKGROUND_EXECUTOR_NAME = "background_executor"; /** * An email address to send memory leak reports to by default. @@ -201,6 +211,17 @@ public class Dependency { new DependencyKey<>(MAIN_HANDLER_NAME); /** + * Generic executor on the main thread. + */ + public static final DependencyKey<Executor> MAIN_EXECUTOR = + new DependencyKey<>(MAIN_EXECUTOR_NAME); + /** + * Generic executor on a background thread. + */ + public static final DependencyKey<Executor> BACKGROUND_EXECUTOR = + new DependencyKey<>(BACKGROUND_EXECUTOR_NAME); + + /** * An email address to send memory leak reports to by default. */ public static final DependencyKey<String> LEAK_REPORT_EMAIL = @@ -304,6 +325,8 @@ public class Dependency { @Inject @Named(TIME_TICK_HANDLER_NAME) Lazy<Handler> mTimeTickHandler; @Nullable @Inject @Named(LEAK_REPORT_EMAIL_NAME) Lazy<String> mLeakReportEmail; + @Inject @Main Lazy<Executor> mMainExecutor; + @Inject @Background Lazy<Executor> mBackgroundExecutor; @Inject Lazy<ClockManager> mClockManager; @Inject Lazy<ActivityManagerWrapper> mActivityManagerWrapper; @Inject Lazy<DevicePolicyManagerWrapper> mDevicePolicyManagerWrapper; @@ -341,6 +364,8 @@ public class Dependency { mProviders.put(BG_LOOPER, mBgLooper::get); mProviders.put(MAIN_LOOPER, mMainLooper::get); mProviders.put(MAIN_HANDLER, mMainHandler::get); + mProviders.put(MAIN_EXECUTOR, mMainExecutor::get); + mProviders.put(BACKGROUND_EXECUTOR, mBackgroundExecutor::get); mProviders.put(ActivityStarter.class, mActivityStarter::get); mProviders.put(BroadcastDispatcher.class, mBroadcastDispatcher::get); diff --git a/packages/SystemUI/src/com/android/systemui/classifier/brightline/DistanceClassifier.java b/packages/SystemUI/src/com/android/systemui/classifier/brightline/DistanceClassifier.java index 0329183e6048..9fa2557c2314 100644 --- a/packages/SystemUI/src/com/android/systemui/classifier/brightline/DistanceClassifier.java +++ b/packages/SystemUI/src/com/android/systemui/classifier/brightline/DistanceClassifier.java @@ -112,7 +112,6 @@ class DistanceClassifier extends FalsingClassifier { private DistanceVectors calculateDistances() { // This code assumes that there will be no missed DOWN or UP events. - VelocityTracker velocityTracker = VelocityTracker.obtain(); List<MotionEvent> motionEvents = getRecentMotionEvents(); if (motionEvents.size() < 3) { @@ -120,6 +119,8 @@ class DistanceClassifier extends FalsingClassifier { return new DistanceVectors(0, 0, 0, 0); } + VelocityTracker velocityTracker = VelocityTracker.obtain(); + for (MotionEvent motionEvent : motionEvents) { velocityTracker.addMovement(motionEvent); } diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemServicesModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemServicesModule.java index e2361d8f415a..8472b1b54c48 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/SystemServicesModule.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemServicesModule.java @@ -318,6 +318,7 @@ public class SystemServicesModule { @Provides @Singleton + @Nullable static WifiManager provideWifiManager(Context context) { return context.getSystemService(WifiManager.class); } diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt b/packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt index 2be509a13816..833d08808a0b 100644 --- a/packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt +++ b/packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt @@ -441,7 +441,8 @@ class MediaDataManager( val app = builder.loadHeaderAppName() // App Icon - val smallIconDrawable: Drawable = sbn.notification.smallIcon.loadDrawable(context) + val smallIconDrawable: Drawable = sbn.notification.smallIcon.loadDrawableAsUser(context, + sbn.user.identifier) // Song name var song: CharSequence? = metadata?.getString(MediaMetadata.METADATA_KEY_DISPLAY_TITLE) diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java index 59597ac29e09..33e98d836d94 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java @@ -23,6 +23,7 @@ import android.app.AlertDialog.Builder; import android.content.Context; import android.content.Intent; import android.content.res.Resources; +import android.os.UserHandle; import android.provider.Settings; import android.service.quicksettings.Tile; import android.telephony.SubscriptionManager; @@ -231,7 +232,8 @@ public class CellularTile extends QSTileImpl<SignalState> { @Override public boolean isAvailable() { - return mController.hasMobileDataFeature(); + return mController.hasMobileDataFeature() + && mHost.getUserContext().getUserId() == UserHandle.USER_SYSTEM; } private static final class CallbackInfo { diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DataSaverTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataSaverTile.java index 8ba60840a666..7ae8fbc928a6 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DataSaverTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataSaverTile.java @@ -66,11 +66,13 @@ public class DataSaverTile extends QSTileImpl<BooleanState> implements dialog.setTitle(com.android.internal.R.string.data_saver_enable_title); dialog.setMessage(com.android.internal.R.string.data_saver_description); dialog.setPositiveButton(com.android.internal.R.string.data_saver_enable_button, - (OnClickListener) (dialogInterface, which) -> toggleDataSaver()); + (OnClickListener) (dialogInterface, which) -> { + toggleDataSaver(); + Prefs.putBoolean(mContext, Prefs.Key.QS_DATA_SAVER_DIALOG_SHOWN, true); + }); dialog.setNegativeButton(com.android.internal.R.string.cancel, null); dialog.setShowForAllUsers(true); dialog.show(); - Prefs.putBoolean(mContext, Prefs.Key.QS_DATA_SAVER_DIALOG_SHOWN, true); } private void toggleDataSaver() { diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java index 4bee075ac63b..7da913592286 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java @@ -39,6 +39,8 @@ import javax.inject.Inject; /** Quick settings tile: Enable/Disable NFC **/ public class NfcTile extends QSTileImpl<BooleanState> { + private final Icon mIcon = ResourceIcon.get(R.drawable.ic_qs_nfc); + private NfcAdapter mAdapter; private BroadcastDispatcher mBroadcastDispatcher; @@ -109,8 +111,7 @@ public class NfcTile extends QSTileImpl<BooleanState> { state.state = getAdapter() == null ? Tile.STATE_UNAVAILABLE : state.value ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE; - state.icon = ResourceIcon.get( - state.value ? R.drawable.ic_qs_nfc_enabled : R.drawable.ic_qs_nfc_disabled); + state.icon = mIcon; state.label = mContext.getString(R.string.quick_settings_nfc_label); state.expandedAccessibilityClassName = Switch.class.getName(); state.contentDescription = state.label; diff --git a/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenMediaRecorder.java b/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenMediaRecorder.java index 1a9abb9cf27d..e6f43c1ff1d2 100644 --- a/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenMediaRecorder.java +++ b/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenMediaRecorder.java @@ -132,7 +132,7 @@ public class ScreenMediaRecorder { mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264); mMediaRecorder.setVideoEncodingProfileLevel( MediaCodecInfo.CodecProfileLevel.AVCProfileHigh, - MediaCodecInfo.CodecProfileLevel.AVCLevel42); + MediaCodecInfo.CodecProfileLevel.AVCLevel3); mMediaRecorder.setVideoSize(screenWidth, screenHeight); mMediaRecorder.setVideoFrameRate(refereshRate); mMediaRecorder.setVideoEncodingBitRate(vidBitRate); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index 7e1dc6634cec..39d2f71e7e0b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -118,6 +118,8 @@ public class KeyguardIndicationController implements StateListener, private boolean mPowerPluggedIn; private boolean mPowerPluggedInWired; private boolean mPowerCharged; + private boolean mBatteryOverheated; + private boolean mEnableBatteryDefender; private int mChargingSpeed; private int mChargingWattage; private int mBatteryLevel; @@ -401,7 +403,7 @@ public class KeyguardIndicationController implements StateListener, } else if (!TextUtils.isEmpty(mAlignmentIndication)) { mTextView.switchIndication(mAlignmentIndication); mTextView.setTextColor(mContext.getColor(R.color.misalignment_text_color)); - } else if (mPowerPluggedIn) { + } else if (mPowerPluggedIn || mEnableBatteryDefender) { String indication = computePowerIndication(); if (animate) { animateText(mTextView, indication); @@ -421,7 +423,7 @@ public class KeyguardIndicationController implements StateListener, String trustManagedIndication = getTrustManagedIndication(); String powerIndication = null; - if (mPowerPluggedIn) { + if (mPowerPluggedIn || mEnableBatteryDefender) { powerIndication = computePowerIndication(); } @@ -451,7 +453,7 @@ public class KeyguardIndicationController implements StateListener, } else if (!TextUtils.isEmpty(mAlignmentIndication)) { mTextView.switchIndication(mAlignmentIndication); isError = true; - } else if (mPowerPluggedIn) { + } else if (mPowerPluggedIn || mEnableBatteryDefender) { if (DEBUG_CHARGING_SPEED) { powerIndication += ", " + (mChargingWattage / 1000) + " mW"; } @@ -528,8 +530,15 @@ public class KeyguardIndicationController implements StateListener, return mContext.getResources().getString(R.string.keyguard_charged); } - final boolean hasChargingTime = mChargingTimeRemaining > 0; int chargingId; + String percentage = NumberFormat.getPercentInstance().format(mBatteryLevel / 100f); + + if (mBatteryOverheated) { + chargingId = R.string.keyguard_plugged_in_charging_limited; + return mContext.getResources().getString(chargingId, percentage); + } + + final boolean hasChargingTime = mChargingTimeRemaining > 0; if (mPowerPluggedInWired) { switch (mChargingSpeed) { case BatteryStatus.CHARGING_FAST: @@ -554,8 +563,6 @@ public class KeyguardIndicationController implements StateListener, : R.string.keyguard_plugged_in_wireless; } - String percentage = NumberFormat.getPercentInstance() - .format(mBatteryLevel / 100f); if (hasChargingTime) { // We now have battery percentage in these strings and it's expected that all // locales will also have it in the future. For now, we still have to support the old @@ -685,6 +692,8 @@ public class KeyguardIndicationController implements StateListener, mChargingWattage = status.maxChargingWattage; mChargingSpeed = status.getChargingSpeed(mContext); mBatteryLevel = status.level; + mBatteryOverheated = status.isOverheated(); + mEnableBatteryDefender = mBatteryOverheated && status.isPluggedIn(); try { mChargingTimeRemaining = mPowerPluggedIn ? mBatteryInfo.computeChargeTimeRemaining() : -1; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java index 8cf8a2299922..01d31039a749 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java @@ -390,17 +390,21 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi } private Drawable getIcon(StatusBarIcon icon) { - return getIcon(getContext(), icon); + Context notifContext = mNotification != null ? + mNotification.getPackageContext(getContext()) : getContext(); + return getIcon(getContext(), notifContext, icon); } /** * Returns the right icon to use for this item * - * @param context Context to use to get resources + * @param sysuiContext Context to use to get scale factor + * @param context Context to use to get resources of notification icon * @return Drawable for this item, or null if the package or item could not * be found */ - public static Drawable getIcon(Context context, StatusBarIcon statusBarIcon) { + public static Drawable getIcon(Context sysuiContext, + Context context, StatusBarIcon statusBarIcon) { int userId = statusBarIcon.user.getIdentifier(); if (userId == UserHandle.USER_ALL) { userId = UserHandle.USER_SYSTEM; @@ -409,7 +413,8 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi Drawable icon = statusBarIcon.icon.loadDrawableAsUser(context, userId); TypedValue typedValue = new TypedValue(); - context.getResources().getValue(R.dimen.status_bar_icon_scale_factor, typedValue, true); + sysuiContext.getResources().getValue(R.dimen.status_bar_icon_scale_factor, + typedValue, true); float scaleFactor = typedValue.getFloat(); // No need to scale the icon, so return it as is. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/NotificationRowBinderImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/NotificationRowBinderImpl.java index 673aa3903156..85a3bc91dc7e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/NotificationRowBinderImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/NotificationRowBinderImpl.java @@ -142,7 +142,6 @@ public class NotificationRowBinderImpl implements NotificationRowBinder { .expandableNotificationRow(row) .notificationEntry(entry) .onDismissRunnable(onDismissRunnable) - .rowContentBindStage(mRowContentBindStage) .onExpandClickListener(mPresenter) .build(); ExpandableNotificationRowController rowController = diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/dagger/ExpandableNotificationRowComponent.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/dagger/ExpandableNotificationRowComponent.java index 9846f2dcd170..321656df504a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/dagger/ExpandableNotificationRowComponent.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/dagger/ExpandableNotificationRowComponent.java @@ -25,7 +25,6 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ActivatableNotificationView; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRowController; -import com.android.systemui.statusbar.notification.row.RowContentBindStage; import com.android.systemui.statusbar.phone.StatusBar; import dagger.Binds; @@ -57,8 +56,6 @@ public interface ExpandableNotificationRowComponent { @BindsInstance Builder onDismissRunnable(@DismissRunnable Runnable runnable); @BindsInstance - Builder rowContentBindStage(RowContentBindStage rowContentBindStage); - @BindsInstance Builder onExpandClickListener(ExpandableNotificationRow.OnExpandClickListener presenter); ExpandableNotificationRowComponent build(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java index e05ba12781c4..1d82e0808332 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java @@ -241,7 +241,7 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable, /** * Set that we are exiting the headsUp pinned mode, but some notifications might still be - * animating out. This is used to keep the touchable regions in a sane state. + * animating out. This is used to keep the touchable regions in a reasonable state. */ void setHeadsUpGoingAway(boolean headsUpGoingAway) { if (headsUpGoingAway != mHeadsUpGoingAway) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java index b47c59acb82d..0a366c9bb380 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -85,8 +85,6 @@ import com.android.systemui.statusbar.policy.PreviewInflater; import com.android.systemui.tuner.LockscreenFragment.LockButtonFactory; import com.android.systemui.tuner.TunerService; -import java.util.concurrent.Executor; - /** * Implementation for the bottom area of the Keyguard, including camera/phone affordance and status * text. @@ -561,7 +559,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL } }; if (!mKeyguardStateController.canDismissLockScreen()) { - Dependency.get(Executor.class).execute(runnable); + Dependency.get(Dependency.BACKGROUND_EXECUTOR).execute(runnable); } else { boolean dismissShade = !TextUtils.isEmpty(mRightButtonStr) && Dependency.get(TunerService.class).getValue(LOCKSCREEN_RIGHT_UNLOCK, 1) != 0; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardLiftController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardLiftController.kt index 74d9f5402e36..bfe0684b5411 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardLiftController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardLiftController.kt @@ -84,7 +84,9 @@ class KeyguardLiftController constructor( val onKeyguard = keyguardUpdateMonitor.isKeyguardVisible && !statusBarStateController.isDozing - val shouldListen = onKeyguard || bouncerVisible + val userId = KeyguardUpdateMonitor.getCurrentUser() + val isFaceEnabled = keyguardUpdateMonitor.isFaceAuthEnabledForUser(userId) + val shouldListen = (onKeyguard || bouncerVisible) && isFaceEnabled if (shouldListen != isListening) { isListening = shouldListen @@ -95,4 +97,4 @@ class KeyguardLiftController constructor( } } } -}
\ No newline at end of file +} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java index 93df14f18fda..0364186a83a2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java @@ -83,15 +83,16 @@ public interface StatusBarIconController { public void removeIcon(String slot, int tag); public void removeAllIconsForSlot(String slot); - public static final String ICON_BLACKLIST = "icon_blacklist"; + // TODO: See if we can rename this tunable name. + String ICON_HIDE_LIST = "icon_blacklist"; - /** Reads the default blacklist from config value unless blacklistStr is provided. */ - static ArraySet<String> getIconBlacklist(Context context, String blackListStr) { + /** Reads the default hide list from config value unless hideListStr is provided. */ + static ArraySet<String> getIconHideList(Context context, String hideListStr) { ArraySet<String> ret = new ArraySet<>(); - String[] blacklist = blackListStr == null + String[] hideList = hideListStr == null ? context.getResources().getStringArray(R.array.config_statusBarIconBlackList) - : blackListStr.split(","); - for (String slot : blacklist) { + : hideListStr.split(","); + for (String slot : hideList) { if (!TextUtils.isEmpty(slot)) { ret.add(slot); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java index d0e806769f14..21e1d319cffa 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java @@ -59,7 +59,7 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu private static final String TAG = "StatusBarIconController"; private final ArrayList<IconManager> mIconGroups = new ArrayList<>(); - private final ArraySet<String> mIconBlacklist = new ArraySet<>(); + private final ArraySet<String> mIconHideList = new ArraySet<>(); // Points to light or dark context depending on the... context? private Context mContext; @@ -79,7 +79,7 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu loadDimens(); commandQueue.addCallback(this); - Dependency.get(TunerService.class).addTunable(this, ICON_BLACKLIST); + Dependency.get(TunerService.class).addTunable(this, ICON_HIDE_LIST); } @Override @@ -89,12 +89,12 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu for (int i = 0; i < allSlots.size(); i++) { Slot slot = allSlots.get(i); List<StatusBarIconHolder> holders = slot.getHolderListInViewOrder(); - boolean blocked = mIconBlacklist.contains(slot.getName()); + boolean hidden = mIconHideList.contains(slot.getName()); for (StatusBarIconHolder holder : holders) { int tag = holder.getTag(); int viewIndex = getViewIndex(getSlotIndex(slot.getName()), holder.getTag()); - group.onIconAdded(viewIndex, slot.getName(), blocked, holder); + group.onIconAdded(viewIndex, slot.getName(), hidden, holder); } } } @@ -107,11 +107,11 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu @Override public void onTuningChanged(String key, String newValue) { - if (!ICON_BLACKLIST.equals(key)) { + if (!ICON_HIDE_LIST.equals(key)) { return; } - mIconBlacklist.clear(); - mIconBlacklist.addAll(StatusBarIconController.getIconBlacklist(mContext, newValue)); + mIconHideList.clear(); + mIconHideList.addAll(StatusBarIconController.getIconHideList(mContext, newValue)); ArrayList<Slot> currentSlots = getSlots(); ArrayMap<Slot, List<StatusBarIconHolder>> slotsToReAdd = new ArrayMap<>(); @@ -142,9 +142,9 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu private void addSystemIcon(int index, StatusBarIconHolder holder) { String slot = getSlotName(index); int viewIndex = getViewIndex(index, holder.getTag()); - boolean blocked = mIconBlacklist.contains(slot); + boolean hidden = mIconHideList.contains(slot); - mIconGroups.forEach(l -> l.onIconAdded(viewIndex, slot, blocked, holder)); + mIconGroups.forEach(l -> l.onIconAdded(viewIndex, slot, hidden, holder)); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java index 690d57345db6..7eefaf28517e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java @@ -52,12 +52,12 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba private final SecurityController mSecurityController; private final Handler mHandler = Handler.getMain(); - private boolean mBlockAirplane; - private boolean mBlockMobile; - private boolean mBlockWifi; - private boolean mBlockEthernet; + private boolean mHideAirplane; + private boolean mHideMobile; + private boolean mHideWifi; + private boolean mHideEthernet; private boolean mActivityEnabled; - private boolean mForceBlockWifi; + private boolean mForceHideWifi; // Track as little state as possible, and only for padding purposes private boolean mIsAirplaneMode = false; @@ -80,7 +80,7 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba mNetworkController = Dependency.get(NetworkController.class); mSecurityController = Dependency.get(SecurityController.class); - Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_BLACKLIST); + Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_HIDE_LIST); mNetworkController.addCallback(this); mSecurityController.addCallback(this); } @@ -114,21 +114,21 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba @Override public void onTuningChanged(String key, String newValue) { - if (!StatusBarIconController.ICON_BLACKLIST.equals(key)) { + if (!StatusBarIconController.ICON_HIDE_LIST.equals(key)) { return; } - ArraySet<String> blockList = StatusBarIconController.getIconBlacklist(mContext, newValue); - boolean blockAirplane = blockList.contains(mSlotAirplane); - boolean blockMobile = blockList.contains(mSlotMobile); - boolean blockWifi = blockList.contains(mSlotWifi); - boolean blockEthernet = blockList.contains(mSlotEthernet); - - if (blockAirplane != mBlockAirplane || blockMobile != mBlockMobile - || blockEthernet != mBlockEthernet || blockWifi != mBlockWifi) { - mBlockAirplane = blockAirplane; - mBlockMobile = blockMobile; - mBlockEthernet = blockEthernet; - mBlockWifi = blockWifi || mForceBlockWifi; + ArraySet<String> hideList = StatusBarIconController.getIconHideList(mContext, newValue); + boolean hideAirplane = hideList.contains(mSlotAirplane); + boolean hideMobile = hideList.contains(mSlotMobile); + boolean hideWifi = hideList.contains(mSlotWifi); + boolean hideEthernet = hideList.contains(mSlotEthernet); + + if (hideAirplane != mHideAirplane || hideMobile != mHideMobile + || hideEthernet != mHideEthernet || hideWifi != mHideWifi) { + mHideAirplane = hideAirplane; + mHideMobile = hideMobile; + mHideEthernet = hideEthernet; + mHideWifi = hideWifi || mForceHideWifi; // Re-register to get new callbacks. mNetworkController.removeCallback(this); mNetworkController.addCallback(this); @@ -140,7 +140,7 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba boolean activityIn, boolean activityOut, String description, boolean isTransient, String statusLabel) { - boolean visible = statusIcon.visible && !mBlockWifi; + boolean visible = statusIcon.visible && !mHideWifi; boolean in = activityIn && mActivityEnabled && visible; boolean out = activityOut && mActivityEnabled && visible; @@ -189,7 +189,7 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba // Visibility of the data type indicator changed boolean typeChanged = statusType != state.typeId && (statusType == 0 || state.typeId == 0); - state.visible = statusIcon.visible && !mBlockMobile; + state.visible = statusIcon.visible && !mHideMobile; state.strengthId = statusIcon.icon; state.typeId = statusType; state.contentDescription = statusIcon.contentDescription; @@ -270,7 +270,7 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba @Override public void setEthernetIndicators(IconState state) { - boolean visible = state.visible && !mBlockEthernet; + boolean visible = state.visible && !mHideEthernet; int resId = state.icon; String description = state.contentDescription; @@ -284,7 +284,7 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba @Override public void setIsAirplaneMode(IconState icon) { - mIsAirplaneMode = icon.visible && !mBlockAirplane; + mIsAirplaneMode = icon.visible && !mHideAirplane; int resId = icon.icon; String description = icon.contentDescription; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java index 6dd96f92b344..120a0e3abba4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java @@ -23,6 +23,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.res.TypedArray; import android.graphics.Rect; +import android.icu.text.DateTimePatternGenerator; import android.os.Bundle; import android.os.Handler; import android.os.Parcelable; @@ -53,8 +54,6 @@ import com.android.systemui.statusbar.policy.ConfigurationController.Configurati import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerService.Tunable; -import libcore.icu.LocaleData; - import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; @@ -192,7 +191,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C mBroadcastDispatcher.registerReceiverWithHandler(mIntentReceiver, filter, Dependency.get(Dependency.TIME_TICK_HANDLER), UserHandle.ALL); Dependency.get(TunerService.class).addTunable(this, CLOCK_SECONDS, - StatusBarIconController.ICON_BLACKLIST); + StatusBarIconController.ICON_HIDE_LIST); mCommandQueue.addCallback(this); if (mShowDark) { Dependency.get(DarkIconDispatcher.class).addDarkReceiver(this); @@ -306,8 +305,8 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C if (CLOCK_SECONDS.equals(key)) { mShowSeconds = TunerService.parseIntegerSwitch(newValue, false); updateShowSeconds(); - } else { - setClockVisibleByUser(!StatusBarIconController.getIconBlacklist(getContext(), newValue) + } else if (StatusBarIconController.ICON_HIDE_LIST.equals(key)) { + setClockVisibleByUser(!StatusBarIconController.getIconHideList(getContext(), newValue) .contains("clock")); updateClockVisibility(); } @@ -391,20 +390,21 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C private final CharSequence getSmallTime() { Context context = getContext(); boolean is24 = DateFormat.is24HourFormat(context, mCurrentUserId); - LocaleData d = LocaleData.get(context.getResources().getConfiguration().locale); + DateTimePatternGenerator dtpg = DateTimePatternGenerator.getInstance( + context.getResources().getConfiguration().locale); final char MAGIC1 = '\uEF00'; final char MAGIC2 = '\uEF01'; SimpleDateFormat sdf; String format = mShowSeconds - ? is24 ? d.timeFormat_Hms : d.timeFormat_hms - : is24 ? d.timeFormat_Hm : d.timeFormat_hm; + ? is24 ? dtpg.getBestPattern("Hms") : dtpg.getBestPattern("hms") + : is24 ? dtpg.getBestPattern("Hm") : dtpg.getBestPattern("hm"); if (!format.equals(mClockFormatString)) { mContentDescriptionFormat = new SimpleDateFormat(format); /* * Search for an unquoted "a" in the format string, so we can - * add dummy characters around it to let us find it again after + * add marker characters around it to let us find it again after * formatting and change its size. */ if (mAmPmStyle != AM_PM_STYLE_NORMAL) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeadZone.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeadZone.java index 54502e41ca64..12d0617d90ff 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeadZone.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeadZone.java @@ -198,7 +198,7 @@ public class DeadZone { can.drawARGB((int) (frac * 0xFF), 0xDD, 0xEE, 0xAA); if (DEBUG && size > mSizeMin) - // crazy aggressive redrawing here, for debugging only + // Very aggressive redrawing here, for debugging only mNavigationBarView.postInvalidateDelayed(100); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java index eb2d9bce6c4e..49be648755c3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java @@ -23,7 +23,6 @@ import android.os.Handler; import android.os.Looper; import android.provider.Settings.Global; import android.telephony.Annotation; -import android.telephony.CdmaEriInformation; import android.telephony.CellSignalStrength; import android.telephony.CellSignalStrengthCdma; import android.telephony.PhoneStateListener; @@ -427,11 +426,9 @@ public class MobileSignalController extends SignalController< if (isCarrierNetworkChangeActive()) { return false; } - if (isCdma() && mServiceState != null) { - final int iconMode = mPhone.getCdmaEriInformation().getEriIconMode(); - return mPhone.getCdmaEriInformation().getEriIconIndex() != CdmaEriInformation.ERI_OFF - && (iconMode == CdmaEriInformation.ERI_ICON_MODE_NORMAL - || iconMode == CdmaEriInformation.ERI_ICON_MODE_FLASH); + if (isCdma()) { + return mPhone.getCdmaEnhancedRoamingIndicatorDisplayNumber() + != TelephonyManager.ERI_OFF; } else { return mServiceState != null && mServiceState.getRoaming(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java index 5b3c3a38c568..df00a4f743ed 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java @@ -24,6 +24,7 @@ import static android.net.wifi.WifiManager.TrafficStateCallback.DATA_ACTIVITY_NO import static android.net.wifi.WifiManager.TrafficStateCallback.DATA_ACTIVITY_OUT; import static android.telephony.PhoneStateListener.LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE; +import android.annotation.Nullable; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; @@ -175,7 +176,7 @@ public class NetworkControllerImpl extends BroadcastReceiver public NetworkControllerImpl(Context context, @Background Looper bgLooper, DeviceProvisionedController deviceProvisionedController, BroadcastDispatcher broadcastDispatcher, ConnectivityManager connectivityManager, - TelephonyManager telephonyManager, WifiManager wifiManager, + TelephonyManager telephonyManager, @Nullable WifiManager wifiManager, NetworkScoreManager networkScoreManager) { this(context, connectivityManager, telephonyManager, @@ -1196,7 +1197,6 @@ public class NetworkControllerImpl extends BroadcastReceiver boolean show4gForLte = false; boolean hideLtePlus = false; boolean hspaDataDistinguishable; - boolean inflateSignalStrengths = false; boolean alwaysShowDataRatIcon = false; static Config readConfig(Context context) { @@ -1208,8 +1208,6 @@ public class NetworkControllerImpl extends BroadcastReceiver res.getBoolean(com.android.internal.R.bool.config_alwaysUseCdmaRssi); config.hspaDataDistinguishable = res.getBoolean(R.bool.config_hspa_data_distinguishable); - config.inflateSignalStrengths = res.getBoolean( - com.android.internal.R.bool.config_inflateSignalStrength); CarrierConfigManager configMgr = (CarrierConfigManager) context.getSystemService(Context.CARRIER_CONFIG_SERVICE); diff --git a/packages/SystemUI/src/com/android/systemui/tuner/BatteryPreference.java b/packages/SystemUI/src/com/android/systemui/tuner/BatteryPreference.java index 66372c311325..b71aafdf6b96 100644 --- a/packages/SystemUI/src/com/android/systemui/tuner/BatteryPreference.java +++ b/packages/SystemUI/src/com/android/systemui/tuner/BatteryPreference.java @@ -38,7 +38,7 @@ public class BatteryPreference extends DropDownPreference implements TunerServic private final String mBattery; private boolean mBatteryEnabled; private boolean mHasPercentage; - private ArraySet<String> mBlacklist; + private ArraySet<String> mHideList; private boolean mHasSetValue; public BatteryPreference(Context context, AttributeSet attrs) { @@ -52,7 +52,7 @@ public class BatteryPreference extends DropDownPreference implements TunerServic super.onAttached(); mHasPercentage = Settings.System.getInt(getContext().getContentResolver(), SHOW_BATTERY_PERCENT, 0) != 0; - Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_BLACKLIST); + Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_HIDE_LIST); } @Override @@ -63,9 +63,9 @@ public class BatteryPreference extends DropDownPreference implements TunerServic @Override public void onTuningChanged(String key, String newValue) { - if (StatusBarIconController.ICON_BLACKLIST.equals(key)) { - mBlacklist = StatusBarIconController.getIconBlacklist(getContext(), newValue); - mBatteryEnabled = !mBlacklist.contains(mBattery); + if (StatusBarIconController.ICON_HIDE_LIST.equals(key)) { + mHideList = StatusBarIconController.getIconHideList(getContext(), newValue); + mBatteryEnabled = !mHideList.contains(mBattery); } if (!mHasSetValue) { // Because of the complicated tri-state it can end up looping and setting state back to @@ -88,12 +88,12 @@ public class BatteryPreference extends DropDownPreference implements TunerServic MetricsLogger.action(getContext(), MetricsEvent.TUNER_BATTERY_PERCENTAGE, v); Settings.System.putInt(getContext().getContentResolver(), SHOW_BATTERY_PERCENT, v ? 1 : 0); if (DISABLED.equals(value)) { - mBlacklist.add(mBattery); + mHideList.add(mBattery); } else { - mBlacklist.remove(mBattery); + mHideList.remove(mBattery); } - Dependency.get(TunerService.class).setValue(StatusBarIconController.ICON_BLACKLIST, - TextUtils.join(",", mBlacklist)); + Dependency.get(TunerService.class).setValue(StatusBarIconController.ICON_HIDE_LIST, + TextUtils.join(",", mHideList)); return true; } } diff --git a/packages/SystemUI/src/com/android/systemui/tuner/ClockPreference.java b/packages/SystemUI/src/com/android/systemui/tuner/ClockPreference.java index f7d0c9fb9d86..c92d7bbfe0b7 100644 --- a/packages/SystemUI/src/com/android/systemui/tuner/ClockPreference.java +++ b/packages/SystemUI/src/com/android/systemui/tuner/ClockPreference.java @@ -33,7 +33,7 @@ public class ClockPreference extends DropDownPreference implements TunerService. private final String mClock; private boolean mClockEnabled; private boolean mHasSeconds; - private ArraySet<String> mBlacklist; + private ArraySet<String> mHideList; private boolean mHasSetValue; private boolean mReceivedSeconds; private boolean mReceivedClock; @@ -47,7 +47,7 @@ public class ClockPreference extends DropDownPreference implements TunerService. @Override public void onAttached() { super.onAttached(); - Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_BLACKLIST, + Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_HIDE_LIST, Clock.CLOCK_SECONDS); } @@ -59,10 +59,10 @@ public class ClockPreference extends DropDownPreference implements TunerService. @Override public void onTuningChanged(String key, String newValue) { - if (StatusBarIconController.ICON_BLACKLIST.equals(key)) { + if (StatusBarIconController.ICON_HIDE_LIST.equals(key)) { mReceivedClock = true; - mBlacklist = StatusBarIconController.getIconBlacklist(getContext(), newValue); - mClockEnabled = !mBlacklist.contains(mClock); + mHideList = StatusBarIconController.getIconHideList(getContext(), newValue); + mClockEnabled = !mHideList.contains(mClock); } else if (Clock.CLOCK_SECONDS.equals(key)) { mReceivedSeconds = true; mHasSeconds = newValue != null && Integer.parseInt(newValue) != 0; @@ -87,12 +87,12 @@ public class ClockPreference extends DropDownPreference implements TunerService. Dependency.get(TunerService.class).setValue(Clock.CLOCK_SECONDS, SECONDS.equals(value) ? 1 : 0); if (DISABLED.equals(value)) { - mBlacklist.add(mClock); + mHideList.add(mClock); } else { - mBlacklist.remove(mClock); + mHideList.remove(mClock); } - Dependency.get(TunerService.class).setValue(StatusBarIconController.ICON_BLACKLIST, - TextUtils.join(",", mBlacklist)); + Dependency.get(TunerService.class).setValue(StatusBarIconController.ICON_HIDE_LIST, + TextUtils.join(",", mHideList)); return true; } } diff --git a/packages/SystemUI/src/com/android/systemui/tuner/StatusBarSwitch.java b/packages/SystemUI/src/com/android/systemui/tuner/StatusBarSwitch.java index de8ccfa848e3..cc0050b64d60 100644 --- a/packages/SystemUI/src/com/android/systemui/tuner/StatusBarSwitch.java +++ b/packages/SystemUI/src/com/android/systemui/tuner/StatusBarSwitch.java @@ -34,7 +34,7 @@ import java.util.Set; public class StatusBarSwitch extends SwitchPreference implements Tunable { - private Set<String> mBlacklist; + private Set<String> mHideList; public StatusBarSwitch(Context context, AttributeSet attrs) { super(context, attrs); @@ -43,7 +43,7 @@ public class StatusBarSwitch extends SwitchPreference implements Tunable { @Override public void onAttached() { super.onAttached(); - Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_BLACKLIST); + Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_HIDE_LIST); } @Override @@ -54,35 +54,35 @@ public class StatusBarSwitch extends SwitchPreference implements Tunable { @Override public void onTuningChanged(String key, String newValue) { - if (!StatusBarIconController.ICON_BLACKLIST.equals(key)) { + if (!StatusBarIconController.ICON_HIDE_LIST.equals(key)) { return; } - mBlacklist = StatusBarIconController.getIconBlacklist(getContext(), newValue); - setChecked(!mBlacklist.contains(getKey())); + mHideList = StatusBarIconController.getIconHideList(getContext(), newValue); + setChecked(!mHideList.contains(getKey())); } @Override protected boolean persistBoolean(boolean value) { if (!value) { - // If not enabled add to blacklist. - if (!mBlacklist.contains(getKey())) { + // If not enabled add to hideList. + if (!mHideList.contains(getKey())) { MetricsLogger.action(getContext(), MetricsEvent.TUNER_STATUS_BAR_DISABLE, getKey()); - mBlacklist.add(getKey()); - setList(mBlacklist); + mHideList.add(getKey()); + setList(mHideList); } } else { - if (mBlacklist.remove(getKey())) { + if (mHideList.remove(getKey())) { MetricsLogger.action(getContext(), MetricsEvent.TUNER_STATUS_BAR_ENABLE, getKey()); - setList(mBlacklist); + setList(mHideList); } } return true; } - private void setList(Set<String> blacklist) { + private void setList(Set<String> hideList) { ContentResolver contentResolver = getContext().getContentResolver(); - Settings.Secure.putStringForUser(contentResolver, StatusBarIconController.ICON_BLACKLIST, - TextUtils.join(",", blacklist), ActivityManager.getCurrentUser()); + Settings.Secure.putStringForUser(contentResolver, StatusBarIconController.ICON_HIDE_LIST, + TextUtils.join(",", hideList), ActivityManager.getCurrentUser()); } } diff --git a/packages/SystemUI/src/com/android/systemui/tuner/TunerServiceImpl.java b/packages/SystemUI/src/com/android/systemui/tuner/TunerServiceImpl.java index 9ad2aa257aa0..644f7582f146 100644 --- a/packages/SystemUI/src/com/android/systemui/tuner/TunerServiceImpl.java +++ b/packages/SystemUI/src/com/android/systemui/tuner/TunerServiceImpl.java @@ -60,7 +60,7 @@ public class TunerServiceImpl extends TunerService { // Things that use the tunable infrastructure but are now real user settings and // shouldn't be reset with tuner settings. - private static final String[] RESET_BLACKLIST = new String[] { + private static final String[] RESET_EXCEPTION_LIST = new String[] { QSTileHost.TILES_SETTING, Settings.Secure.DOZE_ALWAYS_ON, Settings.Secure.MEDIA_CONTROLS_RESUME @@ -116,17 +116,17 @@ public class TunerServiceImpl extends TunerService { private void upgradeTuner(int oldVersion, int newVersion, Handler mainHandler) { if (oldVersion < 1) { - String blacklistStr = getValue(StatusBarIconController.ICON_BLACKLIST); - if (blacklistStr != null) { - ArraySet<String> iconBlacklist = - StatusBarIconController.getIconBlacklist(mContext, blacklistStr); + String hideListStr = getValue(StatusBarIconController.ICON_HIDE_LIST); + if (hideListStr != null) { + ArraySet<String> iconHideList = + StatusBarIconController.getIconHideList(mContext, hideListStr); - iconBlacklist.add("rotate"); - iconBlacklist.add("headset"); + iconHideList.add("rotate"); + iconHideList.add("headset"); Settings.Secure.putStringForUser(mContentResolver, - StatusBarIconController.ICON_BLACKLIST, - TextUtils.join(",", iconBlacklist), mCurrentUser); + StatusBarIconController.ICON_HIDE_LIST, + TextUtils.join(",", iconHideList), mCurrentUser); } } if (oldVersion < 2) { @@ -251,7 +251,7 @@ public class TunerServiceImpl extends TunerService { mContext.sendBroadcast(intent); for (String key : mTunableLookup.keySet()) { - if (ArrayUtils.contains(RESET_BLACKLIST, key)) { + if (ArrayUtils.contains(RESET_EXCEPTION_LIST, key)) { continue; } Settings.Secure.putStringForUser(mContentResolver, key, null, user); diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbAccessoryUriActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbAccessoryUriActivity.java index b5f98ad47c09..89297fd83bb0 100644 --- a/packages/SystemUI/src/com/android/systemui/usb/UsbAccessoryUriActivity.java +++ b/packages/SystemUI/src/com/android/systemui/usb/UsbAccessoryUriActivity.java @@ -54,7 +54,7 @@ public class UsbAccessoryUriActivity extends AlertActivity String uriString = intent.getStringExtra("uri"); mUri = (uriString == null ? null : Uri.parse(uriString)); - // sanity check before displaying dialog + // Exception check before displaying dialog if (mUri == null) { Log.e(TAG, "could not parse Uri " + uriString); finish(); diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbConfirmActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbConfirmActivity.java index 286b7c049fc7..21d700e41a40 100644 --- a/packages/SystemUI/src/com/android/systemui/usb/UsbConfirmActivity.java +++ b/packages/SystemUI/src/com/android/systemui/usb/UsbConfirmActivity.java @@ -35,6 +35,8 @@ import android.os.UserHandle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; +import android.view.Window; +import android.view.WindowManager; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.TextView; @@ -58,6 +60,9 @@ public class UsbConfirmActivity extends AlertActivity @Override public void onCreate(Bundle icicle) { + getWindow().addSystemFlags( + WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS); + super.onCreate(icicle); Intent intent = getIntent(); diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java index f19c49cc123f..699c1393da04 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java @@ -75,6 +75,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.Optional; +import java.util.concurrent.ConcurrentHashMap; import javax.inject.Inject; import javax.inject.Singleton; @@ -829,7 +830,7 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa } class C implements Callbacks { - private final HashMap<Callbacks, Handler> mCallbackMap = new HashMap<>(); + private final Map<Callbacks, Handler> mCallbackMap = new ConcurrentHashMap<>(); public void add(Callbacks callback, Handler handler) { if (callback == null || handler == null) throw new IllegalArgumentException(); |