diff --git a/core/java/android/view/VolumePanel.java b/core/java/android/view/VolumePanel.java index 08ccd941fa07c..662137abf22d4 100644 --- a/core/java/android/view/VolumePanel.java +++ b/core/java/android/view/VolumePanel.java @@ -26,7 +26,6 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; -import android.graphics.drawable.Drawable; import android.media.AudioManager; import android.media.AudioService; import android.media.AudioSystem; @@ -36,13 +35,9 @@ import android.net.Uri; import android.os.Handler; import android.os.Message; import android.os.Vibrator; -import android.telephony.TelephonyManager; import android.util.Log; import android.widget.ImageView; -import android.widget.ProgressBar; import android.widget.SeekBar; -import android.widget.TextView; -import android.widget.Toast; import android.widget.SeekBar.OnSeekBarChangeListener; import java.util.HashMap; @@ -52,6 +47,10 @@ import java.util.HashMap; * * This code really should be moved elsewhere. * + * Seriously, it really really should be moved elsewhere. This is used by + * android.media.AudioService, which actually runs in the system process, to + * show the volume dialog when the user changes the volume. What a mess. + * * @hide */ public class VolumePanel extends Handler implements OnSeekBarChangeListener, View.OnClickListener @@ -194,7 +193,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie window.setGravity(Gravity.TOP); WindowManager.LayoutParams lp = window.getAttributes(); lp.token = null; - lp.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; + lp.type = WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY; window.setAttributes(lp); window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index d1ad1139aafc9..ff378a632623d 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -393,6 +393,13 @@ public interface WindowManager extends ViewManager { */ public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19; + /** + * Window type: The volume level overlay/dialog shown when the user + * changes the system volume. + * @hide + */ + public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20; + /** * End of types of system windows. */ diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index b7f6adffca1a7..bdc37ef4a5700 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -113,6 +113,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG; import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY; import static android.view.WindowManager.LayoutParams.TYPE_TOAST; +import static android.view.WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; import static android.view.WindowManager.LayoutParams.TYPE_POINTER; import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR; @@ -162,36 +163,39 @@ public class PhoneWindowManager implements WindowManagerPolicy { static final int APPLICATION_LAYER = 2; static final int PHONE_LAYER = 3; static final int SEARCH_BAR_LAYER = 4; - static final int STATUS_BAR_SUB_PANEL_LAYER = 5; - static final int SYSTEM_DIALOG_LAYER = 6; + static final int SYSTEM_DIALOG_LAYER = 5; // toasts and the plugged-in battery thing - static final int TOAST_LAYER = 7; + static final int TOAST_LAYER = 6; // SIM errors and unlock. Not sure if this really should be in a high layer. - static final int PRIORITY_PHONE_LAYER = 8; + static final int PRIORITY_PHONE_LAYER = 7; // like the ANR / app crashed dialogs - static final int SYSTEM_ALERT_LAYER = 9; + static final int SYSTEM_ALERT_LAYER = 8; // system-level error dialogs - static final int SYSTEM_ERROR_LAYER = 10; + static final int SYSTEM_ERROR_LAYER = 9; // on-screen keyboards and other such input method user interfaces go here. - static final int INPUT_METHOD_LAYER = 11; + static final int INPUT_METHOD_LAYER = 10; // on-screen keyboards and other such input method user interfaces go here. - static final int INPUT_METHOD_DIALOG_LAYER = 12; + static final int INPUT_METHOD_DIALOG_LAYER = 11; // the keyguard; nothing on top of these can take focus, since they are // responsible for power management when displayed. - static final int KEYGUARD_LAYER = 13; - static final int KEYGUARD_DIALOG_LAYER = 14; + static final int KEYGUARD_LAYER = 12; + static final int KEYGUARD_DIALOG_LAYER = 13; + static final int STATUS_BAR_SUB_PANEL_LAYER = 14; static final int STATUS_BAR_LAYER = 15; static final int STATUS_BAR_PANEL_LAYER = 16; // the navigation bar, if available, shows atop most things static final int NAVIGATION_BAR_LAYER = 17; + // the on-screen volume indicator and controller shown when the user + // changes the device volume + static final int VOLUME_OVERLAY_LAYER = 18; // the drag layer: input for drag-and-drop is associated with this window, // which sits above all other focusable windows - static final int DRAG_LAYER = 18; + static final int DRAG_LAYER = 19; // things in here CAN NOT take focus, but are shown on top of everything else. - static final int SYSTEM_OVERLAY_LAYER = 19; - static final int SECURE_SYSTEM_OVERLAY_LAYER = 20; + static final int SYSTEM_OVERLAY_LAYER = 20; + static final int SECURE_SYSTEM_OVERLAY_LAYER = 21; // the (mouse) pointer layer - static final int POINTER_LAYER = 21; + static final int POINTER_LAYER = 22; static final int APPLICATION_MEDIA_SUBLAYER = -2; static final int APPLICATION_MEDIA_OVERLAY_SUBLAYER = -1; @@ -1057,6 +1061,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { return INPUT_METHOD_LAYER; case TYPE_INPUT_METHOD_DIALOG: return INPUT_METHOD_DIALOG_LAYER; + case TYPE_VOLUME_OVERLAY: + return VOLUME_OVERLAY_LAYER; case TYPE_SYSTEM_OVERLAY: return SYSTEM_OVERLAY_LAYER; case TYPE_SECURE_SYSTEM_OVERLAY: