summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@google.com>2010-08-12 04:58:40 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-08-12 04:58:40 -0700
commitc9faccccb442ce2cdb3168881cd5a4fd9fbc50c4 (patch)
tree43af7da87166c63e21c2f8fe3ff34829dc557d43
parent4ff4a1fa8798af7dc290c0697f006add21f3cb33 (diff)
parent6425ef950c15c47752d17952cb72836e68bd0f65 (diff)
downloadframeworks_base-c9faccccb442ce2cdb3168881cd5a4fd9fbc50c4.zip
frameworks_base-c9faccccb442ce2cdb3168881cd5a4fd9fbc50c4.tar.gz
frameworks_base-c9faccccb442ce2cdb3168881cd5a4fd9fbc50c4.tar.bz2
Merge "System bar settings panel: first pass."
-rw-r--r--packages/SystemUI/res/drawable-hdpi/button_frame_default.9.pngbin0 -> 2878 bytes
-rw-r--r--packages/SystemUI/res/drawable-hdpi/button_frame_pressed.9.pngbin0 -> 5583 bytes
-rw-r--r--packages/SystemUI/res/drawable-hdpi/system_panel_airplane_default.pngbin0 -> 4960 bytes
-rw-r--r--packages/SystemUI/res/drawable-hdpi/system_panel_brightness_default.pngbin0 -> 6073 bytes
-rw-r--r--packages/SystemUI/res/drawable-hdpi/system_panel_orientation_default.pngbin0 -> 5144 bytes
-rw-r--r--packages/SystemUI/res/drawable-hdpi/system_panel_orientation_locked.pngbin0 -> 4923 bytes
-rw-r--r--packages/SystemUI/res/drawable-hdpi/system_panel_sound_default.pngbin0 -> 3294 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/button_frame_default.9.pngbin0 -> 1550 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/button_frame_pressed.9.pngbin0 -> 2842 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/system_panel_airplane_default.pngbin0 -> 3028 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/system_panel_brightness_default.pngbin0 -> 3683 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/system_panel_orientation_default.pngbin0 -> 3829 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/system_panel_orientation_locked.pngbin0 -> 3447 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/system_panel_sound_default.pngbin0 -> 2040 bytes
-rw-r--r--packages/SystemUI/res/drawable/button_frame.xml21
-rw-r--r--packages/SystemUI/res/layout-xlarge/sysbar_panel_system.xml127
-rw-r--r--packages/SystemUI/res/values/strings.xml3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/SystemPanel.java279
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java13
19 files changed, 413 insertions, 30 deletions
diff --git a/packages/SystemUI/res/drawable-hdpi/button_frame_default.9.png b/packages/SystemUI/res/drawable-hdpi/button_frame_default.9.png
new file mode 100644
index 0000000..d809b84
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/button_frame_default.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/button_frame_pressed.9.png b/packages/SystemUI/res/drawable-hdpi/button_frame_pressed.9.png
new file mode 100644
index 0000000..5cc007c
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/button_frame_pressed.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/system_panel_airplane_default.png b/packages/SystemUI/res/drawable-hdpi/system_panel_airplane_default.png
new file mode 100644
index 0000000..e375ee9
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/system_panel_airplane_default.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/system_panel_brightness_default.png b/packages/SystemUI/res/drawable-hdpi/system_panel_brightness_default.png
new file mode 100644
index 0000000..f62502b
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/system_panel_brightness_default.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/system_panel_orientation_default.png b/packages/SystemUI/res/drawable-hdpi/system_panel_orientation_default.png
new file mode 100644
index 0000000..e887fb8
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/system_panel_orientation_default.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/system_panel_orientation_locked.png b/packages/SystemUI/res/drawable-hdpi/system_panel_orientation_locked.png
new file mode 100644
index 0000000..58159d5
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/system_panel_orientation_locked.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/system_panel_sound_default.png b/packages/SystemUI/res/drawable-hdpi/system_panel_sound_default.png
new file mode 100644
index 0000000..6e857b5
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/system_panel_sound_default.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/button_frame_default.9.png b/packages/SystemUI/res/drawable-mdpi/button_frame_default.9.png
new file mode 100644
index 0000000..7ab1f26
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/button_frame_default.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/button_frame_pressed.9.png b/packages/SystemUI/res/drawable-mdpi/button_frame_pressed.9.png
new file mode 100644
index 0000000..08f7a4d
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/button_frame_pressed.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/system_panel_airplane_default.png b/packages/SystemUI/res/drawable-mdpi/system_panel_airplane_default.png
new file mode 100644
index 0000000..eb87532
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/system_panel_airplane_default.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/system_panel_brightness_default.png b/packages/SystemUI/res/drawable-mdpi/system_panel_brightness_default.png
new file mode 100644
index 0000000..3bfc83e
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/system_panel_brightness_default.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/system_panel_orientation_default.png b/packages/SystemUI/res/drawable-mdpi/system_panel_orientation_default.png
new file mode 100644
index 0000000..0d8479c
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/system_panel_orientation_default.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/system_panel_orientation_locked.png b/packages/SystemUI/res/drawable-mdpi/system_panel_orientation_locked.png
new file mode 100644
index 0000000..8f1d26c
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/system_panel_orientation_locked.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/system_panel_sound_default.png b/packages/SystemUI/res/drawable-mdpi/system_panel_sound_default.png
new file mode 100644
index 0000000..22636d6
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/system_panel_sound_default.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable/button_frame.xml b/packages/SystemUI/res/drawable/button_frame.xml
new file mode 100644
index 0000000..5db39a5
--- /dev/null
+++ b/packages/SystemUI/res/drawable/button_frame.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_pressed="true" android:drawable="@drawable/button_frame_pressed" />
+ <item android:drawable="@drawable/button_frame_default" />
+</selector>
+
diff --git a/packages/SystemUI/res/layout-xlarge/sysbar_panel_system.xml b/packages/SystemUI/res/layout-xlarge/sysbar_panel_system.xml
index 2222d08..fc37900 100644
--- a/packages/SystemUI/res/layout-xlarge/sysbar_panel_system.xml
+++ b/packages/SystemUI/res/layout-xlarge/sysbar_panel_system.xml
@@ -2,7 +2,7 @@
<!--
/* apps/common/assets/default/default/skins/StatusBar.xml
**
-** Copyright 2006, The Android Open Source Project
+** Copyright 2010, 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.
@@ -18,35 +18,118 @@
*/
-->
-<!-- android:background="@drawable/status_bar_closed_default_background" -->
-<FrameLayout
+<com.android.systemui.statusbar.tablet.SystemPanel
xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="300dip"
- android:layout_width="400dip"
- android:paddingLeft="8dip"
- android:paddingRight="8dip"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
android:background="#FF000000"
+ android:orientation="vertical"
>
-
- <RelativeLayout
- android:id="@+id/content"
+
+ <TextView android:id="@+id/settings_button"
+ style="?android:attr/textAppearance"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="left|center_vertical"
+ android:layout_marginTop="2dip"
+ android:layout_marginBottom="1dip"
+ android:layout_marginRight="10dip"
+ android:padding="8dip"
+ android:textSize="20sp"
+ android:text="@string/system_panel_settings_button"
+ />
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="1sp"
+ android:background="@android:drawable/divider_horizontal_dark"
+ />
+
+ <LinearLayout
+ android:padding="8dip"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:gravity="center"
+ >
+ <ImageButton android:id="@+id/brightness"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/system_panel_brightness_default"
+ android:background="@drawable/button_frame"
+ />
+ <ImageButton android:id="@+id/sound"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="8dip"
+ android:src="@drawable/system_panel_sound_default"
+ android:background="@drawable/button_frame"
+ />
+ <ImageButton android:id="@+id/orientation"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="8dip"
+ android:src="@drawable/system_panel_orientation_default"
+ android:background="@drawable/button_frame"
+ />
+ <ImageButton android:id="@+id/airplane"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="8dip"
+ android:src="@drawable/system_panel_airplane_default"
+ android:background="@drawable/button_frame"
+ />
+ </LinearLayout>
+
+ <RelativeLayout
+ android:padding="8dip"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:animationCache="false"
- android:background="@drawable/status_bar_background"
- android:clickable="true"
- android:focusable="true"
- android:descendantFocusability="afterDescendants"
+ android:layout_height="wrap_content"
>
+ <ImageView android:id="@+id/battery_meter"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:src="@drawable/dots_empty"
+ />
+
+ <TextView android:id="@+id/battery_info"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/battery_meter"
+ />
+
+ <com.android.systemui.statusbar.Clock
+ style="@*android:style/TextAppearance.StatusBar.Icon"
+ android:id="@+id/clock"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textSize="20sp"
+ android:textStyle="bold"
+ android:padding="2dip"
+ android:layout_centerHorizontal="true"
+ />
+
+ <TextView android:id="@+id/date"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/clock"
+ />
- <TextView
- android:id="@+id/systemPanelDummy"
+ <ImageView android:id="@+id/signal_meter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_centerInParent="true"
- android:textColor="#FFCCCCCC"
- android:textSize="18sp"
+ android:layout_alignParentRight="true"
+ android:src="@drawable/dots_full"
+ />
+
+ <TextView android:id="@+id/signal_info"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/signal_meter"
/>
</RelativeLayout>
-</FrameLayout>
+
+</com.android.systemui.statusbar.tablet.SystemPanel>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index ba3a3d1..2df3b6d 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -51,4 +51,7 @@
power usage activity to find out what drained the battery. -->
<string name="battery_low_why">Battery use</string>
+ <!-- Name of the button that links to the Settings app. [MAXCHARS=NONE] -->
+ <string name="system_panel_settings_button">Settings</string>
+
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SystemPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SystemPanel.java
new file mode 100644
index 0000000..236b521
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SystemPanel.java
@@ -0,0 +1,279 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.statusbar.tablet;
+
+import android.app.Notification;
+import android.app.PendingIntent;
+import android.app.Service;
+import android.app.StatusBarManager;
+import android.content.BroadcastReceiver;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.res.Resources;
+import android.graphics.PixelFormat;
+import android.graphics.Rect;
+import android.media.AudioManager;
+import android.os.AsyncTask;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.IPowerManager;
+import android.os.Message;
+import android.os.RemoteException;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.provider.Settings;
+import android.telephony.PhoneStateListener;
+import android.telephony.ServiceState;
+import android.telephony.TelephonyManager;
+import android.util.AttributeSet;
+import android.util.Slog;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.WindowManager;
+import android.view.WindowManagerImpl;
+import android.widget.Button;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.RemoteViews;
+import android.widget.ScrollView;
+import android.widget.TextSwitcher;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.android.systemui.statusbar.*;
+import com.android.systemui.R;
+
+public class SystemPanel extends LinearLayout {
+ private static final String TAG = "SystemPanel";
+
+ private static final int MINIMUM_BACKLIGHT = android.os.Power.BRIGHTNESS_DIM + 5;
+ private static final int MAXIMUM_BACKLIGHT = android.os.Power.BRIGHTNESS_ON;
+ private static final int DEFAULT_BACKLIGHT = (int) (android.os.Power.BRIGHTNESS_ON * 0.4f);
+
+
+ private TabletStatusBarService mBar;
+ private boolean mAirplaneMode;
+
+ private ImageButton mBrightnessButton;
+ private ImageButton mSoundButton;
+ private ImageButton mOrientationButton;
+ private ImageButton mAirplaneButton;
+
+ private final AudioManager mAudioManager;
+
+
+ private BroadcastReceiver mReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent.getAction().equals(AudioManager.RINGER_MODE_CHANGED_ACTION)) {
+ mSoundButton.setAlpha(getSilentMode() ? 0x7F : 0xFF);
+ }
+ }
+ };
+
+ public void setBar(TabletStatusBarService bar) {
+ mBar = bar;
+ }
+
+ public SystemPanel(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public SystemPanel(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+
+ // get notified of phone state changes
+ TelephonyManager telephonyManager =
+ (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
+ telephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_SERVICE_STATE);
+
+ mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
+ }
+
+ public void onAttachedToWindow() {
+ TextView settingsButton = (TextView)findViewById(R.id.settings_button);
+ settingsButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ getContext().startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS)
+ .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
+ mBar.animateCollapse();
+ }});
+
+ mBrightnessButton = (ImageButton)findViewById(R.id.brightness);
+ mBrightnessButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ rotateBrightness();
+ }
+ });
+
+ mSoundButton = (ImageButton)findViewById(R.id.sound);
+ mSoundButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ setSilentMode(!getSilentMode());
+ mSoundButton.setAlpha(getSilentMode() ? 0x7F : 0xFF);
+ }
+ });
+ mOrientationButton = (ImageButton)findViewById(R.id.orientation);
+ mOrientationButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ Toast.makeText(getContext(), "Orientation control not implemented; please adjust neck angle.", Toast.LENGTH_SHORT).show();
+ }
+ });
+
+ mAirplaneButton = (ImageButton)findViewById(R.id.airplane);
+ mAirplaneButton.setAlpha(mAirplaneMode ? 0xFF : 0x7F);
+ mAirplaneButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ boolean newMode = !getAirplaneMode();
+ Toast.makeText(getContext(), "Attempting to turn "
+ + (newMode ? "on" : "off") + " airplane mode (flaky).",
+ Toast.LENGTH_SHORT).show();
+ setAirplaneMode(newMode);
+ }
+ });
+
+ IntentFilter filter = new IntentFilter(AudioManager.RINGER_MODE_CHANGED_ACTION);
+ getContext().registerReceiver(mReceiver, filter);
+ }
+
+ public void onDetachedFromWindow() {
+ getContext().unregisterReceiver(mReceiver);
+ }
+
+ // ----------------------------------------------------------------------
+
+// private boolean isAutoBrightness() {
+// Context context = getContext();
+// try {
+// IPowerManager power = IPowerManager.Stub.asInterface(
+// ServiceManager.getService("power"));
+// if (power != null) {
+// int brightnessMode = Settings.System.getInt(context.getContentResolver(),
+// Settings.System.SCREEN_BRIGHTNESS_MODE);
+// return brightnessMode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
+// }
+// } catch (RemoteException e) {
+// } catch (Settings.SettingNotFoundException e) {
+// }
+// return false;
+// }
+
+ private void rotateBrightness() {
+ int alpha = 0xFF;
+ Context context = getContext();
+ try {
+ IPowerManager power = IPowerManager.Stub.asInterface(
+ ServiceManager.getService("power"));
+ if (power != null) {
+ ContentResolver cr = context.getContentResolver();
+ int brightness = Settings.System.getInt(cr,
+ Settings.System.SCREEN_BRIGHTNESS);
+ int brightnessMode = Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL;
+ //Only get brightness setting if available
+ if (context.getResources().getBoolean(
+ com.android.internal.R.bool.config_automatic_brightness_available)) {
+ brightnessMode = Settings.System.getInt(cr,
+ Settings.System.SCREEN_BRIGHTNESS_MODE);
+ }
+
+ // Rotate AUTO -> MINIMUM -> DEFAULT -> MAXIMUM
+ // Technically, not a toggle...
+ if (brightnessMode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
+ brightness = MINIMUM_BACKLIGHT;
+ brightnessMode = Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL;
+ alpha = 0x40;
+ } else if (brightness < DEFAULT_BACKLIGHT) {
+ brightness = DEFAULT_BACKLIGHT;
+ alpha = 0xC0;
+ } else if (brightness < MAXIMUM_BACKLIGHT) {
+ brightness = MAXIMUM_BACKLIGHT;
+ alpha = 0xFF;
+ } else {
+ brightnessMode = Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
+ brightness = MINIMUM_BACKLIGHT;
+ alpha = 0x60;
+ }
+
+ if (context.getResources().getBoolean(
+ com.android.internal.R.bool.config_automatic_brightness_available)) {
+ // Set screen brightness mode (automatic or manual)
+ Settings.System.putInt(context.getContentResolver(),
+ Settings.System.SCREEN_BRIGHTNESS_MODE,
+ brightnessMode);
+ } else {
+ // Make sure we set the brightness if automatic mode isn't available
+ brightnessMode = Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL;
+ }
+ if (brightnessMode == Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL) {
+ power.setBacklightBrightness(brightness);
+ Settings.System.putInt(cr, Settings.System.SCREEN_BRIGHTNESS, brightness);
+ }
+ }
+ } catch (RemoteException e) {
+ } catch (Settings.SettingNotFoundException e) {
+ }
+
+ mBrightnessButton.setAlpha(alpha);
+ }
+
+ PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
+ @Override
+ public void onServiceStateChanged(ServiceState serviceState) {
+ Slog.d(TAG, "phone service state changed: " + serviceState.getState());
+ mAirplaneMode = serviceState.getState() == ServiceState.STATE_POWER_OFF;
+ if (mAirplaneButton != null) {
+ mAirplaneButton.setAlpha(mAirplaneMode ? 0xFF : 0x7F);
+ }
+ }
+ };
+
+ private boolean getAirplaneMode() {
+ return mAirplaneMode;
+ }
+
+ private void setAirplaneMode(boolean on) {
+ Settings.System.putInt(
+ mContext.getContentResolver(),
+ Settings.System.AIRPLANE_MODE_ON,
+ on ? 1 : 0);
+ Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
+ intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
+ intent.putExtra("state", on);
+ getContext().sendBroadcast(intent);
+ }
+
+ boolean getSilentMode() {
+ return mAudioManager.getRingerMode() != AudioManager.RINGER_MODE_NORMAL;
+ }
+
+ void setSilentMode(boolean on) {
+ if (on) {
+ mAudioManager.setRingerMode((Settings.System.getInt(mContext.getContentResolver(),
+ Settings.System.VIBRATE_IN_SILENT, 1) == 1)
+ ? AudioManager.RINGER_MODE_VIBRATE
+ : AudioManager.RINGER_MODE_SILENT);
+ } else {
+ mAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
+ }
+ }
+
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java
index 9946ada..9c86f2d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java
@@ -70,7 +70,7 @@ public class TabletStatusBarService extends StatusBarService {
NotificationIconArea mNotificationIconArea;
View mNotificationPanel;
- View mSystemPanel;
+ SystemPanel mSystemPanel;
ViewGroup mPile;
TextView mClearButton;
@@ -87,7 +87,7 @@ public class TabletStatusBarService extends StatusBarService {
protected void addPanelWindows() {
mNotificationPanel = View.inflate(this, R.layout.sysbar_panel_notifications, null);
- mSystemPanel = View.inflate(this, R.layout.sysbar_panel_system, null);
+ mSystemPanel = (SystemPanel) View.inflate(this, R.layout.sysbar_panel_system, null);
mNotificationPanel.setVisibility(View.GONE);
mSystemPanel.setVisibility(View.GONE);
@@ -113,8 +113,8 @@ public class TabletStatusBarService extends StatusBarService {
WindowManagerImpl.getDefault().addView(mNotificationPanel, lp);
lp = new WindowManager.LayoutParams(
- 400, // ViewGroup.LayoutParams.WRAP_CONTENT,
- 200, // ViewGroup.LayoutParams.WRAP_CONTENT,
+ 500, // ViewGroup.LayoutParams.WRAP_CONTENT,
+ ViewGroup.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
@@ -127,6 +127,7 @@ public class TabletStatusBarService extends StatusBarService {
lp.windowAnimations = com.android.internal.R.style.Animation_SlidingCard;
WindowManagerImpl.getDefault().addView(mSystemPanel, lp);
+ mSystemPanel.setBar(this);
}
@Override
@@ -153,10 +154,6 @@ public class TabletStatusBarService extends StatusBarService {
// Add the windows
addPanelWindows();
- // Lorem ipsum, Dolores
- TextView tv = ((TextView) mSystemPanel.findViewById(R.id.systemPanelDummy));
- if (tv != null) tv.setText("System status: great");
-
mPile = (ViewGroup)mNotificationPanel.findViewById(R.id.content);
mPile.removeAllViews();