New small volume dialog
- Remove labels
- Remove output chooser dialog
- Reorder icons
- Add settings affordance
- Add instructive toast
Test: manual
Change-Id: I6640fb8147707936fe22e3c756ab29116973fbe3
Fixes: 73719758
Fixes: 73333233
Fixes: 71663761
diff --git a/packages/SystemUI/src/com/android/systemui/Prefs.java b/packages/SystemUI/src/com/android/systemui/Prefs.java
index 8b57740..ee573fb 100644
--- a/packages/SystemUI/src/com/android/systemui/Prefs.java
+++ b/packages/SystemUI/src/com/android/systemui/Prefs.java
@@ -30,27 +30,28 @@
@Retention(RetentionPolicy.SOURCE)
@StringDef({
- Key.OVERVIEW_LAST_STACK_TASK_ACTIVE_TIME,
- Key.DEBUG_MODE_ENABLED,
- Key.HOTSPOT_TILE_LAST_USED,
- Key.COLOR_INVERSION_TILE_LAST_USED,
- Key.DND_TILE_VISIBLE,
- Key.DND_TILE_COMBINED_ICON,
- Key.DND_CONFIRMED_PRIORITY_INTRODUCTION,
- Key.DND_CONFIRMED_SILENCE_INTRODUCTION,
- Key.DND_FAVORITE_BUCKET_INDEX,
- Key.DND_NONE_SELECTED,
- Key.DND_FAVORITE_ZEN,
- Key.QS_HOTSPOT_ADDED,
- Key.QS_DATA_SAVER_ADDED,
- Key.QS_DATA_SAVER_DIALOG_SHOWN,
- Key.QS_INVERT_COLORS_ADDED,
- Key.QS_WORK_ADDED,
- Key.QS_NIGHTDISPLAY_ADDED,
- Key.QS_LONG_PRESS_TOOLTIP_SHOWN_COUNT,
- Key.SEEN_MULTI_USER,
- Key.NUM_APPS_LAUNCHED,
- Key.HAS_SEEN_RECENTS_ONBOARDING,
+ Key.OVERVIEW_LAST_STACK_TASK_ACTIVE_TIME,
+ Key.DEBUG_MODE_ENABLED,
+ Key.HOTSPOT_TILE_LAST_USED,
+ Key.COLOR_INVERSION_TILE_LAST_USED,
+ Key.DND_TILE_VISIBLE,
+ Key.DND_TILE_COMBINED_ICON,
+ Key.DND_CONFIRMED_PRIORITY_INTRODUCTION,
+ Key.DND_CONFIRMED_SILENCE_INTRODUCTION,
+ Key.DND_FAVORITE_BUCKET_INDEX,
+ Key.DND_NONE_SELECTED,
+ Key.DND_FAVORITE_ZEN,
+ Key.QS_HOTSPOT_ADDED,
+ Key.QS_DATA_SAVER_ADDED,
+ Key.QS_DATA_SAVER_DIALOG_SHOWN,
+ Key.QS_INVERT_COLORS_ADDED,
+ Key.QS_WORK_ADDED,
+ Key.QS_NIGHTDISPLAY_ADDED,
+ Key.QS_LONG_PRESS_TOOLTIP_SHOWN_COUNT,
+ Key.SEEN_MULTI_USER,
+ Key.NUM_APPS_LAUNCHED,
+ Key.HAS_SEEN_RECENTS_ONBOARDING,
+ Key.SEEN_RINGER_GUIDANCE_COUNT
})
public @interface Key {
@Deprecated
@@ -85,6 +86,7 @@
String SEEN_MULTI_USER = "HasSeenMultiUser";
String NUM_APPS_LAUNCHED = "NumAppsLaunched";
String HAS_SEEN_RECENTS_ONBOARDING = "HasSeenRecentsOnboarding";
+ String SEEN_RINGER_GUIDANCE_COUNT = "RingerGuidanceCount";
}
public static boolean getBoolean(Context context, @Key String key, boolean defaultValue) {
diff --git a/packages/SystemUI/src/com/android/systemui/volume/OutputChooserDialog.java b/packages/SystemUI/src/com/android/systemui/volume/OutputChooserDialog.java
deleted file mode 100644
index 6ed07f8..0000000
--- a/packages/SystemUI/src/com/android/systemui/volume/OutputChooserDialog.java
+++ /dev/null
@@ -1,534 +0,0 @@
-/*
- * Copyright (C) 2017 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.volume;
-
-import static android.support.v7.media.MediaRouter.RouteInfo.CONNECTION_STATE_CONNECTED;
-import static android.support.v7.media.MediaRouter.RouteInfo.CONNECTION_STATE_CONNECTING;
-import static android.support.v7.media.MediaRouter.UNSELECT_REASON_DISCONNECTED;
-
-import static com.android.settingslib.bluetooth.Utils.getBtClassDrawableWithDescription;
-
-import android.app.Dialog;
-import android.bluetooth.BluetoothClass;
-import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothProfile;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.graphics.Color;
-import android.graphics.drawable.ColorDrawable;
-import android.graphics.drawable.Drawable;
-import android.net.Uri;
-import android.net.wifi.WifiManager;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.os.SystemClock;
-import android.support.v7.media.MediaControlIntent;
-import android.support.v7.media.MediaRouteSelector;
-import android.support.v7.media.MediaRouter;
-import android.telecom.TelecomManager;
-import android.util.Log;
-import android.util.Pair;
-import android.view.Window;
-import android.view.WindowManager;
-
-import com.android.internal.logging.MetricsLogger;
-import com.android.internal.logging.nano.MetricsProto;
-import com.android.settingslib.Utils;
-import com.android.settingslib.bluetooth.CachedBluetoothDevice;
-import com.android.systemui.Dependency;
-import com.android.systemui.HardwareUiLayout;
-import com.android.systemui.Interpolators;
-import com.android.systemui.R;
-import com.android.systemui.plugins.VolumeDialogController;
-import com.android.systemui.statusbar.policy.BluetoothController;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.List;
-
-public class OutputChooserDialog extends Dialog
- implements DialogInterface.OnDismissListener, OutputChooserLayout.Callback {
-
- private static final String TAG = Util.logTag(OutputChooserDialog.class);
- private static final int MAX_DEVICES = 10;
-
- private static final long UPDATE_DELAY_MS = 300L;
- private static final int MSG_UPDATE_ITEMS = 1;
-
- private final Context mContext;
- private final BluetoothController mBluetoothController;
- private WifiManager mWifiManager;
- private OutputChooserLayout mView;
- private final MediaRouterWrapper mRouter;
- private final MediaRouterCallback mRouterCallback;
- private long mLastUpdateTime;
- static final boolean INCLUDE_MEDIA_ROUTES = false;
- private boolean mIsInCall;
- protected boolean isAttached;
-
- private final MediaRouteSelector mRouteSelector;
- private Drawable mDefaultIcon;
- private Drawable mTvIcon;
- private Drawable mSpeakerIcon;
- private Drawable mSpeakerGroupIcon;
- private HardwareUiLayout mHardwareLayout;
- private final VolumeDialogController mController;
-
- public OutputChooserDialog(Context context, MediaRouterWrapper router) {
- super(context, com.android.systemui.R.style.qs_theme);
- mContext = context;
- mBluetoothController = Dependency.get(BluetoothController.class);
- mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
- TelecomManager tm = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
- mIsInCall = tm.isInCall();
- mRouter = router;
- mRouterCallback = new MediaRouterCallback();
- mRouteSelector = new MediaRouteSelector.Builder()
- .addControlCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK)
- .build();
-
- final IntentFilter filter = new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
- context.registerReceiver(mReceiver, filter);
-
- mController = Dependency.get(VolumeDialogController.class);
-
- // Window initialization
- Window window = getWindow();
- window.requestFeature(Window.FEATURE_NO_TITLE);
- window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
- window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND
- | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
- window.addFlags(
- WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
- | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
- | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
- | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
- | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
- window.setType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY);
- }
-
- protected void setIsInCall(boolean inCall) {
- mIsInCall = inCall;
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.output_chooser);
- setCanceledOnTouchOutside(true);
- setOnDismissListener(this::onDismiss);
-
- mView = findViewById(R.id.output_chooser);
- mHardwareLayout = HardwareUiLayout.get(mView);
- mHardwareLayout.setOutsideTouchListener(view -> dismiss());
- mHardwareLayout.setSwapOrientation(false);
- mView.setCallback(this);
-
- if (mIsInCall) {
- mView.setTitle(R.string.output_calls_title);
- } else {
- mView.setTitle(R.string.output_title);
- }
-
- mDefaultIcon = mContext.getDrawable(R.drawable.ic_cast);
- mTvIcon = mContext.getDrawable(R.drawable.ic_tv);
- mSpeakerIcon = mContext.getDrawable(R.drawable.ic_speaker);
- mSpeakerGroupIcon = mContext.getDrawable(R.drawable.ic_speaker_group);
-
- final boolean wifiOff = !mWifiManager.isWifiEnabled();
- final boolean btOff = !mBluetoothController.isBluetoothEnabled();
- if (wifiOff && btOff) {
- mView.setEmptyState(getDisabledServicesMessage(wifiOff, btOff));
- }
- // time out after 5 seconds
- mView.postDelayed(() -> updateItems(true), 5000);
- }
-
- protected void cleanUp() {}
-
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- public void onAttachedToWindow() {
- super.onAttachedToWindow();
-
- if (!mIsInCall && INCLUDE_MEDIA_ROUTES) {
- mRouter.addCallback(mRouteSelector, mRouterCallback,
- MediaRouter.CALLBACK_FLAG_PERFORM_ACTIVE_SCAN);
- }
- mBluetoothController.addCallback(mCallback);
- mController.addCallback(mControllerCallbackH, mHandler);
- isAttached = true;
- }
-
- @Override
- public void onDetachedFromWindow() {
- isAttached = false;
- mRouter.removeCallback(mRouterCallback);
- mController.removeCallback(mControllerCallbackH);
- mBluetoothController.removeCallback(mCallback);
- super.onDetachedFromWindow();
- }
-
- @Override
- public void onDismiss(DialogInterface unused) {
- mContext.unregisterReceiver(mReceiver);
- cleanUp();
- }
-
- @Override
- public void show() {
- super.show();
- Dependency.get(MetricsLogger.class).visible(MetricsProto.MetricsEvent.OUTPUT_CHOOSER);
- mHardwareLayout.setTranslationX(getAnimTranslation());
- mHardwareLayout.setAlpha(0);
- mHardwareLayout.animate()
- .alpha(1)
- .translationX(0)
- .setDuration(300)
- .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
- .withEndAction(() -> getWindow().getDecorView().requestAccessibilityFocus())
- .start();
- }
-
- @Override
- public void dismiss() {
- Dependency.get(MetricsLogger.class).hidden(MetricsProto.MetricsEvent.OUTPUT_CHOOSER);
- mHardwareLayout.setTranslationX(0);
- mHardwareLayout.setAlpha(1);
- mHardwareLayout.animate()
- .alpha(0)
- .translationX(getAnimTranslation())
- .setDuration(300)
- .withEndAction(() -> super.dismiss())
- .setInterpolator(new SystemUIInterpolators.LogAccelerateInterpolator())
- .start();
- }
-
- private float getAnimTranslation() {
- return getContext().getResources().getDimension(
- com.android.systemui.R.dimen.output_chooser_panel_width) / 2;
- }
-
- @Override
- public void onDetailItemClick(OutputChooserLayout.Item item) {
- if (item == null || item.tag == null) return;
- if (item.deviceType == OutputChooserLayout.Item.DEVICE_TYPE_BT) {
- final CachedBluetoothDevice device = (CachedBluetoothDevice) item.tag;
- if (device.getMaxConnectionState() == BluetoothProfile.STATE_DISCONNECTED) {
- Dependency.get(MetricsLogger.class).action(
- MetricsProto.MetricsEvent.ACTION_OUTPUT_CHOOSER_CONNECT);
- mBluetoothController.connect(device);
- }
- } else if (item.deviceType == OutputChooserLayout.Item.DEVICE_TYPE_MEDIA_ROUTER) {
- final MediaRouter.RouteInfo route = (MediaRouter.RouteInfo) item.tag;
- if (route.isEnabled()) {
- Dependency.get(MetricsLogger.class).action(
- MetricsProto.MetricsEvent.ACTION_OUTPUT_CHOOSER_CONNECT);
- route.select();
- }
- }
- }
-
- @Override
- public void onDetailItemDisconnect(OutputChooserLayout.Item item) {
- if (item == null || item.tag == null) return;
- if (item.deviceType == OutputChooserLayout.Item.DEVICE_TYPE_BT) {
- final CachedBluetoothDevice device = (CachedBluetoothDevice) item.tag;
- Dependency.get(MetricsLogger.class).action(
- MetricsProto.MetricsEvent.ACTION_OUTPUT_CHOOSER_DISCONNECT);
- mBluetoothController.disconnect(device);
- } else if (item.deviceType == OutputChooserLayout.Item.DEVICE_TYPE_MEDIA_ROUTER) {
- Dependency.get(MetricsLogger.class).action(
- MetricsProto.MetricsEvent.ACTION_OUTPUT_CHOOSER_DISCONNECT);
- mRouter.unselect(UNSELECT_REASON_DISCONNECTED);
- }
- }
-
- private void updateItems(boolean timeout) {
- if (SystemClock.uptimeMillis() - mLastUpdateTime < UPDATE_DELAY_MS) {
- mHandler.removeMessages(MSG_UPDATE_ITEMS);
- mHandler.sendMessageAtTime(mHandler.obtainMessage(MSG_UPDATE_ITEMS, timeout),
- mLastUpdateTime + UPDATE_DELAY_MS);
- return;
- }
- mLastUpdateTime = SystemClock.uptimeMillis();
- if (mView == null) return;
- ArrayList<OutputChooserLayout.Item> items = new ArrayList<>();
-
- // Add bluetooth devices
- addBluetoothDevices(items);
-
- // Add remote displays
- if (!mIsInCall && INCLUDE_MEDIA_ROUTES) {
- addRemoteDisplayRoutes(items);
- }
-
- items.sort(ItemComparator.sInstance);
-
- if (items.size() == 0 && timeout) {
- String emptyMessage = mContext.getString(R.string.output_none_found);
- final boolean wifiOff = !mWifiManager.isWifiEnabled();
- final boolean btOff = !mBluetoothController.isBluetoothEnabled();
- if (wifiOff || btOff) {
- emptyMessage = getDisabledServicesMessage(wifiOff, btOff);
- }
- mView.setEmptyState(emptyMessage);
- }
-
- mView.setItems(items.toArray(new OutputChooserLayout.Item[items.size()]));
- }
-
- private String getDisabledServicesMessage(boolean wifiOff, boolean btOff) {
- return mContext.getString(R.string.output_none_found_service_off,
- wifiOff && btOff ? mContext.getString(R.string.output_service_bt_wifi)
- : wifiOff ? mContext.getString(R.string.output_service_wifi)
- : mContext.getString(R.string.output_service_bt));
- }
-
- private void addBluetoothDevices(List<OutputChooserLayout.Item> items) {
- final Collection<CachedBluetoothDevice> devices = mBluetoothController.getDevices();
- if (devices != null) {
- int connectedDevices = 0;
- int count = 0;
- for (CachedBluetoothDevice device : devices) {
- if (mBluetoothController.getBondState(device) == BluetoothDevice.BOND_NONE) continue;
- final int majorClass = device.getBtClass().getMajorDeviceClass();
- if (majorClass != BluetoothClass.Device.Major.AUDIO_VIDEO
- && majorClass != BluetoothClass.Device.Major.UNCATEGORIZED) {
- continue;
- }
- final OutputChooserLayout.Item item = new OutputChooserLayout.Item();
- item.iconResId = R.drawable.ic_qs_bluetooth_on;
- item.line1 = device.getName();
- item.tag = device;
- item.deviceType = OutputChooserLayout.Item.DEVICE_TYPE_BT;
- int state = device.getMaxConnectionState();
- if (state == BluetoothProfile.STATE_CONNECTED) {
- item.iconResId = R.drawable.ic_qs_bluetooth_connected;
- int batteryLevel = device.getBatteryLevel();
- if (batteryLevel != BluetoothDevice.BATTERY_LEVEL_UNKNOWN) {
- Pair<Drawable, String> pair =
- getBtClassDrawableWithDescription(getContext(), device);
- item.icon = pair.first;
- item.line2 = mContext.getString(
- R.string.quick_settings_connected_battery_level,
- Utils.formatPercentage(batteryLevel));
- } else {
- item.line2 = mContext.getString(R.string.quick_settings_connected);
- }
- item.canDisconnect = true;
- items.add(connectedDevices, item);
- connectedDevices++;
- } else if (state == BluetoothProfile.STATE_CONNECTING) {
- item.iconResId = R.drawable.ic_qs_bluetooth_connecting;
- item.line2 = mContext.getString(R.string.quick_settings_connecting);
- items.add(connectedDevices, item);
- } else {
- items.add(item);
- }
- if (++count == MAX_DEVICES) {
- break;
- }
- }
- }
- }
-
- private void addRemoteDisplayRoutes(List<OutputChooserLayout.Item> items) {
- List<MediaRouter.RouteInfo> routes = mRouter.getRoutes();
- for(MediaRouter.RouteInfo route : routes) {
- if (route.isDefaultOrBluetooth() || !route.isEnabled()
- || !route.matchesSelector(mRouteSelector)) {
- continue;
- }
- final OutputChooserLayout.Item item = new OutputChooserLayout.Item();
- item.icon = getIconDrawable(route);
- item.line1 = route.getName();
- item.tag = route;
- item.deviceType = OutputChooserLayout.Item.DEVICE_TYPE_MEDIA_ROUTER;
- if (route.getConnectionState() == CONNECTION_STATE_CONNECTING) {
- mContext.getString(R.string.quick_settings_connecting);
- } else {
- item.line2 = route.getDescription();
- }
-
- if (route.getConnectionState() == CONNECTION_STATE_CONNECTED) {
- item.canDisconnect = true;
- }
- items.add(item);
- }
- }
-
- private Drawable getIconDrawable(MediaRouter.RouteInfo route) {
- Uri iconUri = route.getIconUri();
- if (iconUri != null) {
- try {
- InputStream is = getContext().getContentResolver().openInputStream(iconUri);
- Drawable drawable = Drawable.createFromStream(is, null);
- if (drawable != null) {
- return drawable;
- }
- } catch (IOException e) {
- Log.w(TAG, "Failed to load " + iconUri, e);
- // Falls back.
- }
- }
- return getDefaultIconDrawable(route);
- }
-
- private Drawable getDefaultIconDrawable(MediaRouter.RouteInfo route) {
- // If the type of the receiver device is specified, use it.
- switch (route.getDeviceType()) {
- case MediaRouter.RouteInfo.DEVICE_TYPE_TV:
- return mTvIcon;
- case MediaRouter.RouteInfo.DEVICE_TYPE_SPEAKER:
- return mSpeakerIcon;
- }
-
- // Otherwise, make the best guess based on other route information.
- if (route instanceof MediaRouter.RouteGroup) {
- // Only speakers can be grouped for now.
- return mSpeakerGroupIcon;
- }
- return mDefaultIcon;
- }
-
- private final class MediaRouterCallback extends MediaRouter.Callback {
- @Override
- public void onRouteAdded(MediaRouter router, MediaRouter.RouteInfo info) {
- updateItems(false);
- }
-
- @Override
- public void onRouteRemoved(MediaRouter router, MediaRouter.RouteInfo info) {
- updateItems(false);
- }
-
- @Override
- public void onRouteChanged(MediaRouter router, MediaRouter.RouteInfo info) {
- updateItems(false);
- }
-
- @Override
- public void onRouteSelected(MediaRouter router, MediaRouter.RouteInfo route) {
- updateItems(false);
- }
- }
-
- private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(intent.getAction())) {
- if (D.BUG) Log.d(TAG, "Received ACTION_CLOSE_SYSTEM_DIALOGS");
- cancel();
- cleanUp();
- }
- }
- };
-
- private final BluetoothController.Callback mCallback = new BluetoothController.Callback() {
- @Override
- public void onBluetoothStateChange(boolean enabled) {
- updateItems(false);
- }
-
- @Override
- public void onBluetoothDevicesChanged() {
- updateItems(false);
- }
- };
-
- static final class ItemComparator implements Comparator<OutputChooserLayout.Item> {
- public static final ItemComparator sInstance = new ItemComparator();
-
- @Override
- public int compare(OutputChooserLayout.Item lhs, OutputChooserLayout.Item rhs) {
- // Connected item(s) first
- if (lhs.canDisconnect != rhs.canDisconnect) {
- return Boolean.compare(rhs.canDisconnect, lhs.canDisconnect);
- }
- // Bluetooth items before media routes
- if (lhs.deviceType != rhs.deviceType) {
- return Integer.compare(lhs.deviceType, rhs.deviceType);
- }
- // then by name
- return lhs.line1.toString().compareToIgnoreCase(rhs.line1.toString());
- }
- }
-
- private final Handler mHandler = new Handler() {
- @Override
- public void handleMessage(Message message) {
- switch (message.what) {
- case MSG_UPDATE_ITEMS:
- updateItems((Boolean) message.obj);
- break;
- }
- }
- };
-
- private final VolumeDialogController.Callbacks mControllerCallbackH
- = new VolumeDialogController.Callbacks() {
- @Override
- public void onShowRequested(int reason) {
- dismiss();
- }
-
- @Override
- public void onDismissRequested(int reason) {}
-
- @Override
- public void onScreenOff() {
- dismiss();
- }
-
- @Override
- public void onStateChanged(VolumeDialogController.State state) {}
-
- @Override
- public void onLayoutDirectionChanged(int layoutDirection) {}
-
- @Override
- public void onConfigurationChanged() {}
-
- @Override
- public void onShowVibrateHint() {}
-
- @Override
- public void onShowSilentHint() {}
-
- @Override
- public void onShowSafetyWarning(int flags) {}
-
- @Override
- public void onAccessibilityModeChanged(Boolean showA11yStream) {}
-
- @Override
- public void onConnectedDeviceChanged(String deviceName) {}
- };
-}
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/volume/OutputChooserLayout.java b/packages/SystemUI/src/com/android/systemui/volume/OutputChooserLayout.java
deleted file mode 100644
index d4c6f89..0000000
--- a/packages/SystemUI/src/com/android/systemui/volume/OutputChooserLayout.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Copyright (C) 2017 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.volume;
-
-import android.content.Context;
-import android.content.res.Configuration;
-import android.graphics.drawable.Drawable;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.Message;
-import android.text.TextUtils;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import com.android.systemui.FontSizeUtils;
-import com.android.systemui.R;
-import com.android.systemui.qs.AutoSizingList;
-
-/**
- * Limited height list of devices.
- */
-public class OutputChooserLayout extends LinearLayout {
- private static final String TAG = "OutputChooserLayout";
- private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
-
- private final Context mContext;
- private final H mHandler = new H();
- private final Adapter mAdapter = new Adapter();
-
- private String mTag;
- private Callback mCallback;
- private boolean mItemsVisible = true;
- private AutoSizingList mItemList;
- private View mEmpty;
- private TextView mEmptyText;
- private TextView mTitle;
-
- private Item[] mItems;
-
- public OutputChooserLayout(Context context, AttributeSet attrs) {
- super(context, attrs);
- mContext = context;
- mTag = TAG;
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- mItemList = findViewById(android.R.id.list);
- mItemList.setVisibility(GONE);
- mItemList.setAdapter(mAdapter);
- mEmpty = findViewById(android.R.id.empty);
- mEmpty.setVisibility(GONE);
- mEmptyText = mEmpty.findViewById(R.id.empty_text);
- mTitle = findViewById(R.id.title);
- }
-
- @Override
- protected void onConfigurationChanged(Configuration newConfig) {
- super.onConfigurationChanged(newConfig);
- FontSizeUtils.updateFontSize(mEmptyText, R.dimen.qs_detail_empty_text_size);
- int count = mItemList.getChildCount();
- for (int i = 0; i < count; i++) {
- View item = mItemList.getChildAt(i);
- FontSizeUtils.updateFontSize(item, R.id.empty_text,
- R.dimen.qs_detail_item_primary_text_size);
- FontSizeUtils.updateFontSize(item, android.R.id.summary,
- R.dimen.qs_detail_item_secondary_text_size);
- FontSizeUtils.updateFontSize(item, android.R.id.title,
- R.dimen.qs_detail_header_text_size);
- }
- }
-
- public void setTitle(int title) {
- mTitle.setText(title);
- }
-
- public void setEmptyState(String text) {
- mEmptyText.setText(text);
- }
-
- @Override
- protected void onAttachedToWindow() {
- super.onAttachedToWindow();
- if (DEBUG) Log.d(mTag, "onAttachedToWindow");
- }
-
- @Override
- protected void onDetachedFromWindow() {
- super.onDetachedFromWindow();
- if (DEBUG) Log.d(mTag, "onDetachedFromWindow");
- mCallback = null;
- }
-
- public void setCallback(Callback callback) {
- mHandler.removeMessages(H.SET_CALLBACK);
- mHandler.obtainMessage(H.SET_CALLBACK, callback).sendToTarget();
- }
-
- public void setItems(Item[] items) {
- mHandler.removeMessages(H.SET_ITEMS);
- mHandler.obtainMessage(H.SET_ITEMS, items).sendToTarget();
- }
-
- public void setItemsVisible(boolean visible) {
- mHandler.removeMessages(H.SET_ITEMS_VISIBLE);
- mHandler.obtainMessage(H.SET_ITEMS_VISIBLE, visible ? 1 : 0, 0).sendToTarget();
- }
-
- private void handleSetCallback(Callback callback) {
- mCallback = callback;
- }
-
- private void handleSetItems(Item[] items) {
- final int itemCount = items != null ? items.length : 0;
- mEmpty.setVisibility(itemCount == 0 ? VISIBLE : GONE);
- mItemList.setVisibility(itemCount == 0 ? GONE : VISIBLE);
- mItems = items;
- mAdapter.notifyDataSetChanged();
- }
-
- private void handleSetItemsVisible(boolean visible) {
- if (mItemsVisible == visible) return;
- mItemsVisible = visible;
- for (int i = 0; i < mItemList.getChildCount(); i++) {
- mItemList.getChildAt(i).setVisibility(mItemsVisible ? VISIBLE : INVISIBLE);
- }
- }
-
- private class Adapter extends BaseAdapter {
-
- @Override
- public int getCount() {
- return mItems != null ? mItems.length : 0;
- }
-
- @Override
- public Object getItem(int position) {
- return mItems[position];
- }
-
- @Override
- public long getItemId(int position) {
- return 0;
- }
-
- @Override
- public View getView(int position, View view, ViewGroup parent) {
- final Item item = mItems[position];
- if (view == null) {
- view = LayoutInflater.from(mContext).inflate(R.layout.output_chooser_item, parent,
- false);
- }
- view.setVisibility(mItemsVisible ? VISIBLE : INVISIBLE);
- final ImageView iv = view.findViewById(android.R.id.icon);
- if (item.icon != null) {
- iv.setImageDrawable(item.icon);
- } else {
- iv.setImageResource(item.iconResId);
- }
- final TextView title = view.findViewById(android.R.id.title);
- title.setText(item.line1);
- final TextView summary = view.findViewById(android.R.id.summary);
- final boolean twoLines = !TextUtils.isEmpty(item.line2);
- title.setMaxLines(twoLines ? 1 : 2);
- summary.setVisibility(twoLines ? VISIBLE : GONE);
- summary.setText(twoLines ? item.line2 : null);
- view.setOnClickListener(v -> {
- if (mCallback != null) {
- mCallback.onDetailItemClick(item);
- }
- });
-
- final ImageView icon2 = view.findViewById(android.R.id.icon2);
- if (item.canDisconnect) {
- icon2.setImageResource(R.drawable.ic_qs_cancel);
- icon2.setVisibility(VISIBLE);
- icon2.setClickable(true);
- icon2.setOnClickListener(v -> {
- if (mCallback != null) {
- mCallback.onDetailItemDisconnect(item);
- }
- });
- } else if (item.icon2 != -1) {
- icon2.setVisibility(VISIBLE);
- icon2.setImageResource(item.icon2);
- icon2.setClickable(false);
- } else {
- icon2.setVisibility(GONE);
- }
-
- return view;
- }
- };
-
- private class H extends Handler {
- private static final int SET_ITEMS = 1;
- private static final int SET_CALLBACK = 2;
- private static final int SET_ITEMS_VISIBLE = 3;
-
- public H() {
- super(Looper.getMainLooper());
- }
-
- @Override
- public void handleMessage(Message msg) {
- if (msg.what == SET_ITEMS) {
- handleSetItems((Item[]) msg.obj);
- } else if (msg.what == SET_CALLBACK) {
- handleSetCallback((OutputChooserLayout.Callback) msg.obj);
- } else if (msg.what == SET_ITEMS_VISIBLE) {
- handleSetItemsVisible(msg.arg1 != 0);
- }
- }
- }
-
- public static class Item {
- public static int DEVICE_TYPE_BT = 1;
- public static int DEVICE_TYPE_MEDIA_ROUTER = 2;
- public int iconResId;
- public Drawable icon;
- public Drawable overlay;
- public CharSequence line1;
- public CharSequence line2;
- public Object tag;
- public boolean canDisconnect;
- public int icon2 = -1;
- public int deviceType = 0;
- }
-
- public interface Callback {
- void onDetailItemClick(Item item);
- void onDetailItemDisconnect(Item item);
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java
index 3c29b77..7c71b2a 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java
@@ -110,11 +110,7 @@
private boolean mShowA11yStream;
private boolean mShowVolumeDialog;
private boolean mShowSafetyWarning;
- private DeviceCallback mDeviceCallback = new DeviceCallback();
private final NotificationManager mNotificationManager;
- @GuardedBy("mLock")
- private List<AudioDeviceInfo> mConnectedDevices = new ArrayList<>();
- private Object mLock = new Object();
private boolean mDestroyed;
private VolumePolicy mVolumePolicy;
@@ -192,7 +188,6 @@
} catch (SecurityException e) {
Log.w(TAG, "No access to media sessions", e);
}
- mAudio.registerAudioDeviceCallback(mDeviceCallback, mWorker);
}
public void setVolumePolicy(VolumePolicy policy) {
@@ -218,7 +213,6 @@
mMediaSessions.destroy();
mObserver.destroy();
mReceiver.destroy();
- mAudio.unregisterAudioDeviceCallback(mDeviceCallback);
mWorkerThread.quitSafely();
}
@@ -842,18 +836,6 @@
});
}
}
-
- @Override
- public void onConnectedDeviceChanged(String deviceName) {
- for (final Map.Entry<Callbacks, Handler> entry : mCallbackMap.entrySet()) {
- entry.getValue().post(new Runnable() {
- @Override
- public void run() {
- entry.getKey().onConnectedDeviceChanged(deviceName);
- }
- });
- }
- }
}
@@ -1060,33 +1042,6 @@
}
}
- protected final class DeviceCallback extends AudioDeviceCallback {
- public void onAudioDevicesAdded(AudioDeviceInfo[] addedDevices) {
- synchronized (mLock) {
- for (AudioDeviceInfo info : addedDevices) {
- if (info.isSink()
- && (info.getType() == AudioDeviceInfo.TYPE_BLUETOOTH_A2DP
- || info.getType() == AudioDeviceInfo.TYPE_BLUETOOTH_SCO)) {
- mConnectedDevices.add(info);
- mCallbacks.onConnectedDeviceChanged(info.getProductName().toString());
- }
- }
- }
- }
-
- public void onAudioDevicesRemoved(AudioDeviceInfo[] removedDevices) {
- synchronized (mLock) {
- for (AudioDeviceInfo info : removedDevices) {
- mConnectedDevices.remove(info);
- }
-
- if (mConnectedDevices.size() == 0) {
- mCallbacks.onConnectedDeviceChanged(null);
- }
- }
- }
- }
-
public interface UserActivityListener {
void onUserActivity();
}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
index 1e8e98c..90a9fc8 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
@@ -18,22 +18,22 @@
import static android.accessibilityservice.AccessibilityServiceInfo.FEEDBACK_ALL_MASK;
import static android.accessibilityservice.AccessibilityServiceInfo.FEEDBACK_GENERIC;
+import static android.media.AudioManager.RINGER_MODE_MAX;
+import static android.media.AudioManager.RINGER_MODE_NORMAL;
+import static android.media.AudioManager.RINGER_MODE_SILENT;
+import static android.media.AudioManager.RINGER_MODE_VIBRATE;
import static android.media.AudioManager.STREAM_ACCESSIBILITY;
-import static com.android.systemui.volume.Events.DISMISS_REASON_OUTPUT_CHOOSER;
import static com.android.systemui.volume.Events.DISMISS_REASON_SETTINGS_CLICKED;
-import static com.android.systemui.volume.Events.DISMISS_REASON_TOUCH_OUTSIDE;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.animation.ObjectAnimator;
-import android.annotation.NonNull;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.KeyguardManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
-import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Color;
@@ -48,9 +48,7 @@
import android.os.SystemClock;
import android.provider.Settings;
import android.provider.Settings.Global;
-import android.support.v7.media.MediaRouter;
import android.text.InputFilter;
-import android.text.TextUtils;
import android.util.Log;
import android.util.Slog;
import android.util.SparseBooleanArray;
@@ -60,7 +58,6 @@
import android.view.View;
import android.view.View.AccessibilityDelegate;
import android.view.View.OnAttachStateChangeListener;
-import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
@@ -72,9 +69,11 @@
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
+import android.widget.Toast;
import com.android.settingslib.Utils;
import com.android.systemui.Dependency;
+import com.android.systemui.Prefs;
import com.android.systemui.R;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.VolumeDialog;
@@ -108,18 +107,16 @@
private CustomDialog mDialog;
private ViewGroup mDialogView;
private ViewGroup mDialogRowsView;
- private ViewGroup mFooter;
+ private ViewGroup mRinger;
private ImageButton mRingerIcon;
+ private ImageButton mSettingsIcon;
private ImageView mZenIcon;
- private TextView mRingerStatus;
- private TextView mRingerTitle;
private final List<VolumeRow> mRows = new ArrayList<>();
private ConfigurableTexts mConfigurableTexts;
private final SparseBooleanArray mDynamic = new SparseBooleanArray();
private final KeyguardManager mKeyguard;
private final AccessibilityManagerWrapper mAccessibilityMgr;
private final Object mSafetyWarningLock = new Object();
- private final Object mOutputChooserLock = new Object();
private final Accessibility mAccessibility = new Accessibility();
private final ColorStateList mActiveSliderTint;
private final ColorStateList mInactiveSliderTint;
@@ -133,7 +130,6 @@
private boolean mSilentMode = VolumePrefs.DEFAULT_ENABLE_SILENT_MODE;
private State mState;
private SafetyWarningDialog mSafetyWarning;
- private OutputChooserDialog mOutputChooserDialog;
private boolean mHovering = false;
public VolumeDialogImpl(Context context) {
@@ -215,11 +211,10 @@
uiLayout.updateRotation();
mDialogRowsView = mDialog.findViewById(R.id.volume_dialog_rows);
- mFooter = mDialog.findViewById(R.id.footer);
- mRingerIcon = mFooter.findViewById(R.id.ringer_icon);
- mRingerStatus = mFooter.findViewById(R.id.ringer_status);
- mRingerTitle = mFooter.findViewById(R.id.ringer_title);
- mZenIcon = mFooter.findViewById(R.id.dnd_icon);
+ mRinger = mDialog.findViewById(R.id.ringer);
+ mRingerIcon = mRinger.findViewById(R.id.ringer_icon);
+ mZenIcon = mRinger.findViewById(R.id.dnd_icon);
+ mSettingsIcon = mDialog.findViewById(R.id.settings);
if (mRows.isEmpty()) {
addRow(AudioManager.STREAM_MUSIC,
@@ -244,6 +239,7 @@
updateRowsH(getActiveRow());
initRingerH();
+ initSettingsH();
}
protected ViewGroup getDialogView() {
@@ -358,10 +354,6 @@
row.slider.setOnSeekBarChangeListener(new VolumeSeekBarChangeListener(row));
row.anim = null;
- row.outputChooser = row.view.findViewById(R.id.output_chooser);
- row.outputChooser.setOnClickListener(mClickOutputChooser);
- row.connectedDevice = row.view.findViewById(R.id.volume_row_connected_device);
-
row.icon = row.view.findViewById(R.id.volume_row_icon);
row.icon.setImageResource(iconRes);
if (row.stream != AudioSystem.STREAM_ACCESSIBILITY) {
@@ -396,6 +388,15 @@
}
}
+ public void initSettingsH() {
+ mSettingsIcon.setOnClickListener(v -> {
+ Intent intent = new Intent(Settings.ACTION_SOUND_SETTINGS);
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ dismissH(DISMISS_REASON_SETTINGS_CLICKED);
+ Dependency.get(ActivityStarter.class).startActivity(intent, true /* dismissShade */);
+ });
+ }
+
public void initRingerH() {
mRingerIcon.setOnClickListener(v -> {
Events.writeEvent(mContext, Events.EVENT_ICON_CLICK, AudioManager.STREAM_RING,
@@ -406,34 +407,55 @@
}
// normal -> vibrate -> silent -> normal (skip vibrate if device doesn't have
// a vibrator.
+ int newRingerMode;
final boolean hasVibrator = mController.hasVibrator();
if (mState.ringerModeInternal == AudioManager.RINGER_MODE_NORMAL) {
if (hasVibrator) {
mController.vibrate();
- mController.setRingerMode(AudioManager.RINGER_MODE_VIBRATE, false);
+ newRingerMode = AudioManager.RINGER_MODE_VIBRATE;
} else {
- mController.setRingerMode(AudioManager.RINGER_MODE_SILENT, false);
+ newRingerMode = AudioManager.RINGER_MODE_SILENT;
}
} else if (mState.ringerModeInternal == AudioManager.RINGER_MODE_VIBRATE) {
- mController.setRingerMode(AudioManager.RINGER_MODE_SILENT, false);
+ newRingerMode = AudioManager.RINGER_MODE_SILENT;
} else {
- mController.setRingerMode(AudioManager.RINGER_MODE_NORMAL, false);
+ newRingerMode = AudioManager.RINGER_MODE_NORMAL;
if (ss.level == 0) {
mController.setStreamVolume(AudioManager.STREAM_RING, 1);
}
}
updateRingerH();
- });
- mRingerIcon.setOnLongClickListener(v -> {
- Intent intent = new Intent(Settings.ACTION_SOUND_SETTINGS);
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- dismissH(DISMISS_REASON_SETTINGS_CLICKED);
- Dependency.get(ActivityStarter.class).startActivity(intent, true /* dismissShade */);
- return true;
+
+ mController.setRingerMode(newRingerMode, false);
+ maybeShowToastH(newRingerMode);
});
updateRingerH();
}
+ private void maybeShowToastH(int newRingerMode) {
+ int seenToastCount = Prefs.getInt(mContext, Prefs.Key.SEEN_RINGER_GUIDANCE_COUNT, 0);
+
+ if (seenToastCount > VolumePrefs.SHOW_RINGER_TOAST_COUNT) {
+ return;
+ }
+ int toastText;
+ switch (newRingerMode) {
+ case RINGER_MODE_NORMAL:
+ toastText = R.string.volume_dialog_ringer_guidance_ring;
+ break;
+ case RINGER_MODE_SILENT:
+ toastText = R.string.volume_dialog_ringer_guidance_silent;
+ break;
+ case RINGER_MODE_VIBRATE:
+ default:
+ toastText = R.string.volume_dialog_ringer_guidance_vibrate;
+ }
+
+ Toast.makeText(mContext, toastText, Toast.LENGTH_SHORT).show();
+ seenToastCount++;
+ Prefs.putInt(mContext, Prefs.Key.SEEN_RINGER_GUIDANCE_COUNT, seenToastCount);
+ }
+
public void show(int reason) {
mHandler.obtainMessage(H.SHOW, reason, 0).sendToTarget();
}
@@ -501,15 +523,6 @@
}
}
- private boolean isAttached() {
- return mDialogView != null && mDialogView.isAttachedToWindow();
- }
-
- private boolean hasTouchFeature() {
- final PackageManager pm = mContext.getPackageManager();
- return pm.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN);
- }
-
private boolean shouldBeVisibleH(VolumeRow row, VolumeRow activeRow) {
boolean isActive = row == activeRow;
if (row.stream == AudioSystem.STREAM_ACCESSIBILITY) {
@@ -536,20 +549,12 @@
final boolean isActive = row == activeRow;
final boolean shouldBeVisible = shouldBeVisibleH(row, activeRow);
Util.setVisOrGone(row.view, shouldBeVisible);
- Util.setVisOrGone(row.header, shouldBeVisible);
if (row.view.isShown()) {
updateVolumeRowSliderTintH(row, isActive);
}
}
}
- protected void updateConnectedDeviceH(String deviceName) {
- for (final VolumeRow row : mRows) {
- row.connectedDevice.setText(deviceName);
- Util.setVisOrGone(row.connectedDevice, !TextUtils.isEmpty(deviceName));
- }
- }
-
protected void updateRingerH() {
if (mState != null) {
final StreamState ss = mState.states.get(AudioManager.STREAM_RING);
@@ -560,12 +565,10 @@
enableRingerViewsH(mState.zenMode == Global.ZEN_MODE_OFF || !mState.disallowRinger);
switch (mState.ringerModeInternal) {
case AudioManager.RINGER_MODE_VIBRATE:
- mRingerStatus.setText(R.string.volume_ringer_status_vibrate);
mRingerIcon.setImageResource(R.drawable.ic_volume_ringer_vibrate);
mRingerIcon.setTag(Events.ICON_STATE_VIBRATE);
break;
case AudioManager.RINGER_MODE_SILENT:
- mRingerStatus.setText(R.string.volume_ringer_status_silent);
mRingerIcon.setImageResource(R.drawable.ic_volume_ringer_mute);
mRingerIcon.setContentDescription(mContext.getString(
R.string.volume_stream_content_description_unmute,
@@ -576,14 +579,12 @@
default:
boolean muted = (mAutomute && ss.level == 0) || ss.muted;
if (muted) {
- mRingerStatus.setText(R.string.volume_ringer_status_silent);
mRingerIcon.setImageResource(R.drawable.ic_volume_ringer_mute);
mRingerIcon.setContentDescription(mContext.getString(
R.string.volume_stream_content_description_unmute,
getStreamLabelH(ss)));
mRingerIcon.setTag(Events.ICON_STATE_MUTE);
} else {
- mRingerStatus.setText(R.string.volume_ringer_status_normal);
mRingerIcon.setImageResource(R.drawable.ic_volume_ringer);
if (mController.hasVibrator()) {
mRingerIcon.setContentDescription(mContext.getString(
@@ -603,12 +604,11 @@
}
/**
- * Toggles enable state of views in a VolumeRow (not including seekbar, outputChooser or icon)
+ * Toggles enable state of views in a VolumeRow (not including seekbar or icon)
* Hides/shows zen icon
* @param enable whether to enable volume row views and hide dnd icon
*/
private void enableVolumeRowViewsH(VolumeRow row, boolean enable) {
- row.header.setEnabled(enable);
row.dndIcon.setVisibility(enable ? View.GONE : View.VISIBLE);
}
@@ -618,8 +618,6 @@
* @param enable whether to enable ringer views and hide dnd icon
*/
private void enableRingerViewsH(boolean enable) {
- mRingerTitle.setEnabled(enable);
- mRingerStatus.setEnabled(enable);
mRingerIcon.setEnabled(enable);
mZenIcon.setVisibility(enable ? View.GONE : View.VISIBLE);
}
@@ -889,24 +887,6 @@
rescheduleTimeoutH();
}
- private void showOutputChooserH() {
- synchronized (mOutputChooserLock) {
- if (mOutputChooserDialog != null) {
- return;
- }
- mOutputChooserDialog = new OutputChooserDialog(mContext,
- new MediaRouterWrapper(MediaRouter.getInstance(mContext))) {
- @Override
- protected void cleanUp() {
- synchronized (mOutputChooserLock) {
- mOutputChooserDialog = null;
- }
- }
- };
- mOutputChooserDialog.show();
- }
- }
-
private String getStreamLabelH(StreamState ss) {
if (ss.remoteLabel != null) {
return ss.remoteLabel;
@@ -919,14 +899,6 @@
}
}
- private final OnClickListener mClickOutputChooser = new OnClickListener() {
- @Override
- public void onClick(View v) {
- dismissH(DISMISS_REASON_OUTPUT_CHOOSER);
- showOutputChooserH();
- }
- };
-
private final VolumeDialogController.Callbacks mControllerCallbackH
= new VolumeDialogController.Callbacks() {
@Override
@@ -991,11 +963,6 @@
}
}
-
- @Override
- public void onConnectedDeviceChanged(String deviceName) {
- updateConnectedDeviceH(deviceName);
- }
};
private final class H extends Handler {
@@ -1184,8 +1151,6 @@
private ObjectAnimator anim; // slider progress animation for non-touch-related updates
private int animTargetProgress;
private int lastAudibleLevel = 1;
- private View outputChooser;
- private TextView connectedDevice;
private ImageView dndIcon;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumePrefs.java b/packages/SystemUI/src/com/android/systemui/volume/VolumePrefs.java
index 04339eb..173400f 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumePrefs.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumePrefs.java
@@ -43,6 +43,8 @@
public static final String PREF_ADJUST_ALARMS = "pref_adjust_alarms";
public static final String PREF_ADJUST_NOTIFICATION = "pref_adjust_notification";
+ public static final int SHOW_RINGER_TOAST_COUNT = 9;
+
public static final boolean DEFAULT_SHOW_HEADERS = true;
public static final boolean DEFAULT_ENABLE_AUTOMUTE = true;
public static final boolean DEFAULT_ENABLE_SILENT_MODE = true;