summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r--packages/SystemUI/src/com/android/systemui/DreamsDockLauncher.java78
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java42
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java59
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java23
4 files changed, 96 insertions, 106 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/DreamsDockLauncher.java b/packages/SystemUI/src/com/android/systemui/DreamsDockLauncher.java
deleted file mode 100644
index 73249b4..0000000
--- a/packages/SystemUI/src/com/android/systemui/DreamsDockLauncher.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.android.systemui;
-
-import android.app.Activity;
-import android.content.BroadcastReceiver;
-import android.content.ComponentName;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.provider.Settings;
-import android.util.Slog;
-
-public class DreamsDockLauncher extends Activity {
- private static final String TAG = "DreamsDockLauncher";
-
- // Launch the screen saver if started as an activity.
- @Override
- protected void onCreate (Bundle icicle) {
- super.onCreate(icicle);
- launchDream(this);
- finish();
- }
-
- private static void launchDream(Context context) {
- try {
- String component = Settings.Secure.getString(
- context.getContentResolver(), Settings.Secure.SCREENSAVER_COMPONENT);
- if (component == null) {
- component = context.getResources().getString(
- com.android.internal.R.string.config_defaultDreamComponent);
- }
- if (component != null) {
- // dismiss the notification shade, recents, etc.
- context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
-
- ComponentName cn = ComponentName.unflattenFromString(component);
- Intent zzz = new Intent(Intent.ACTION_MAIN)
- .setComponent(cn)
- .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
- | Intent.FLAG_ACTIVITY_NO_USER_ACTION
- | Intent.FLAG_FROM_BACKGROUND
- | Intent.FLAG_ACTIVITY_NO_HISTORY
- );
- Slog.v(TAG, "Starting screen saver on dock event: " + component);
- context.startActivity(zzz);
- } else {
- Slog.e(TAG, "Couldn't start screen saver: none selected");
- }
- } catch (android.content.ActivityNotFoundException exc) {
- // no screensaver? give up
- Slog.e(TAG, "Couldn't start screen saver: none installed");
- }
- }
-
- // Trap low-level dock events and launch the screensaver.
- public static class DockEventReceiver extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
- final boolean activateOnDock = 0 != Settings.Secure.getInt(
- context.getContentResolver(),
- Settings.Secure.SCREENSAVER_ACTIVATE_ON_DOCK, 0);
-
- if (!activateOnDock) return;
-
- if (Intent.ACTION_DOCK_EVENT.equals(intent.getAction())) {
- Bundle extras = intent.getExtras();
- int state = extras
- .getInt(Intent.EXTRA_DOCK_STATE, Intent.EXTRA_DOCK_STATE_UNDOCKED);
- if (state == Intent.EXTRA_DOCK_STATE_DESK
- || state == Intent.EXTRA_DOCK_STATE_LE_DESK
- || state == Intent.EXTRA_DOCK_STATE_HE_DESK) {
- launchDream(context);
- }
- }
- }
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index c337ebe..2f22cae 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -182,6 +182,7 @@ public class PhoneStatusBar extends BaseStatusBar {
private TextView mCarrierLabel;
private boolean mCarrierLabelVisible = false;
private int mCarrierLabelHeight;
+ private TextView mEmergencyCallLabel;
// drag bar
CloseDragHandle mCloseView;
@@ -409,14 +410,6 @@ public class PhoneStatusBar extends BaseStatusBar {
mPile = (NotificationRowLayout)mStatusBarWindow.findViewById(R.id.latestItems);
mPile.setLayoutTransitionsEnabled(false);
mPile.setLongPressListener(getNotificationLongClicker());
- if (SHOW_CARRIER_LABEL) {
- mPile.setOnSizeChangedListener(new OnSizeChangedListener() {
- @Override
- public void onSizeChanged(View view, int w, int h, int oldw, int oldh) {
- updateCarrierLabelVisibility(false);
- }
- });
- }
mExpandedContents = mPile; // was: expanded.findViewById(R.id.notificationLinearLayout);
mClearButton = mStatusBarWindow.findViewById(R.id.clear_all_button);
@@ -429,9 +422,6 @@ public class PhoneStatusBar extends BaseStatusBar {
mSettingsButton.setOnClickListener(mSettingsButtonListener);
mRotationButton = (RotationToggle) mStatusBarWindow.findViewById(R.id.rotation_lock_button);
- mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label);
- mCarrierLabel.setVisibility(mCarrierLabelVisible ? View.VISIBLE : View.INVISIBLE);
-
mScrollView = (ScrollView)mStatusBarWindow.findViewById(R.id.scroll);
mScrollView.setVerticalScrollBarEnabled(false); // less drawing during pulldowns
@@ -460,7 +450,21 @@ public class PhoneStatusBar extends BaseStatusBar {
mNetworkController.addSignalCluster(signalCluster);
signalCluster.setNetworkController(mNetworkController);
+ mEmergencyCallLabel = (TextView)mStatusBarWindow.findViewById(R.id.emergency_calls_only);
+ if (mEmergencyCallLabel != null) {
+ mNetworkController.addEmergencyLabelView(mEmergencyCallLabel);
+ mEmergencyCallLabel.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
+ @Override
+ public void onLayoutChange(View v, int left, int top, int right, int bottom,
+ int oldLeft, int oldTop, int oldRight, int oldBottom) {
+ updateCarrierLabelVisibility(false);
+ }});
+ }
+
if (SHOW_CARRIER_LABEL) {
+ mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label);
+ mCarrierLabel.setVisibility(mCarrierLabelVisible ? View.VISIBLE : View.INVISIBLE);
+
// for mobile devices, we always show mobile connection info here (SPN/PLMN)
// for other devices, we show whatever network is connected
if (mNetworkController.hasMobileDataFeature()) {
@@ -468,6 +472,14 @@ public class PhoneStatusBar extends BaseStatusBar {
} else {
mNetworkController.addCombinedLabelView(mCarrierLabel);
}
+
+ // set up the dynamic hide/show of the label
+ mPile.setOnSizeChangedListener(new OnSizeChangedListener() {
+ @Override
+ public void onSizeChanged(View view, int w, int h, int oldw, int oldh) {
+ updateCarrierLabelVisibility(false);
+ }
+ });
}
// final ImageView wimaxRSSI =
@@ -919,9 +931,11 @@ public class PhoneStatusBar extends BaseStatusBar {
Slog.d(TAG, String.format("pileh=%d scrollh=%d carrierh=%d",
mPile.getHeight(), mScrollView.getHeight(), mCarrierLabelHeight));
}
-
- final boolean makeVisible =
- mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight);
+
+ final boolean emergencyCallsShownElsewhere = mEmergencyCallLabel != null;
+ final boolean makeVisible =
+ !(emergencyCallsShownElsewhere && mNetworkController.isEmergencyOnly())
+ && mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight);
if (force || mCarrierLabelVisible != makeVisible) {
mCarrierLabelVisible = makeVisible;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
index 1068267..8cf7b4a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
@@ -145,6 +145,7 @@ public class NetworkController extends BroadcastReceiver {
ArrayList<TextView> mCombinedLabelViews = new ArrayList<TextView>();
ArrayList<TextView> mMobileLabelViews = new ArrayList<TextView>();
ArrayList<TextView> mWifiLabelViews = new ArrayList<TextView>();
+ ArrayList<TextView> mEmergencyLabelViews = new ArrayList<TextView>();
ArrayList<SignalCluster> mSignalClusters = new ArrayList<SignalCluster>();
int mLastPhoneSignalIconId = -1;
int mLastDataDirectionIconId = -1;
@@ -245,6 +246,10 @@ public class NetworkController extends BroadcastReceiver {
return mHasMobileDataFeature;
}
+ public boolean isEmergencyOnly() {
+ return (mServiceState != null && mServiceState.isEmergencyOnly());
+ }
+
public void addPhoneSignalIconView(ImageView v) {
mPhoneSignalIconViews.add(v);
}
@@ -284,6 +289,10 @@ public class NetworkController extends BroadcastReceiver {
mWifiLabelViews.add(v);
}
+ public void addEmergencyLabelView(TextView v) {
+ mEmergencyLabelViews.add(v);
+ }
+
public void addSignalCluster(SignalCluster cluster) {
mSignalClusters.add(cluster);
refreshSignalCluster(cluster);
@@ -566,18 +575,26 @@ public class NetworkController extends BroadcastReceiver {
}
break;
case TelephonyManager.NETWORK_TYPE_CDMA:
- // display 1xRTT for IS95A/B
- mDataIconList = TelephonyIcons.DATA_1X[mInetCondition];
- mDataTypeIconId = R.drawable.stat_sys_data_connected_1x;
- mContentDescriptionDataType = mContext.getString(
- R.string.accessibility_data_connection_cdma);
- break;
+ if (!mShowAtLeastThreeGees) {
+ // display 1xRTT for IS95A/B
+ mDataIconList = TelephonyIcons.DATA_1X[mInetCondition];
+ mDataTypeIconId = R.drawable.stat_sys_data_connected_1x;
+ mContentDescriptionDataType = mContext.getString(
+ R.string.accessibility_data_connection_cdma);
+ break;
+ } else {
+ // fall through
+ }
case TelephonyManager.NETWORK_TYPE_1xRTT:
- mDataIconList = TelephonyIcons.DATA_1X[mInetCondition];
- mDataTypeIconId = R.drawable.stat_sys_data_connected_1x;
- mContentDescriptionDataType = mContext.getString(
- R.string.accessibility_data_connection_cdma);
- break;
+ if (!mShowAtLeastThreeGees) {
+ mDataIconList = TelephonyIcons.DATA_1X[mInetCondition];
+ mDataTypeIconId = R.drawable.stat_sys_data_connected_1x;
+ mContentDescriptionDataType = mContext.getString(
+ R.string.accessibility_data_connection_cdma);
+ break;
+ } else {
+ // fall through
+ }
case TelephonyManager.NETWORK_TYPE_EVDO_0: //fall through
case TelephonyManager.NETWORK_TYPE_EVDO_A:
case TelephonyManager.NETWORK_TYPE_EVDO_B:
@@ -917,6 +934,7 @@ public class NetworkController extends BroadcastReceiver {
String wifiLabel = "";
String mobileLabel = "";
int N;
+ final boolean emergencyOnly = isEmergencyOnly();
if (!mHasMobileDataFeature) {
mDataSignalIconId = mPhoneSignalIconId = 0;
@@ -932,10 +950,12 @@ public class NetworkController extends BroadcastReceiver {
if (mDataConnected) {
mobileLabel = mNetworkName;
- } else if (mConnected) {
- if (hasService()) {
+ } else if (mConnected || emergencyOnly) {
+ if (hasService() || emergencyOnly) {
+ // The isEmergencyOnly test covers the case of a phone with no SIM
mobileLabel = mNetworkName;
} else {
+ // Tablets, basically
mobileLabel = "";
}
} else {
@@ -1076,6 +1096,7 @@ public class NetworkController extends BroadcastReceiver {
+ " combinedActivityIconId=0x" + Integer.toHexString(combinedActivityIconId)
+ " mobileLabel=" + mobileLabel
+ " wifiLabel=" + wifiLabel
+ + " emergencyOnly=" + emergencyOnly
+ " combinedLabel=" + combinedLabel
+ " mAirplaneMode=" + mAirplaneMode
+ " mDataActivity=" + mDataActivity
@@ -1241,6 +1262,18 @@ public class NetworkController extends BroadcastReceiver {
v.setVisibility(View.VISIBLE);
}
}
+
+ // e-call label
+ N = mEmergencyLabelViews.size();
+ for (int i=0; i<N; i++) {
+ TextView v = mEmergencyLabelViews.get(i);
+ if (!emergencyOnly) {
+ v.setVisibility(View.GONE);
+ } else {
+ v.setText(mobileLabel); // comes from the telephony stack
+ v.setVisibility(View.VISIBLE);
+ }
+ }
}
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
index fdbfb65..c1ea50d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
@@ -25,6 +25,7 @@ import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Slog;
import android.view.Gravity;
+import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
@@ -34,7 +35,6 @@ import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.RelativeLayout;
-import android.widget.ScrollView;
import com.android.systemui.ExpandHelper;
import com.android.systemui.R;
@@ -197,6 +197,27 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
return true;
}
+ @Override
+ public boolean dispatchKeyEvent(KeyEvent event) {
+ final int keyCode = event.getKeyCode();
+ switch (keyCode) {
+ // We exclusively handle the back key by hiding this panel.
+ case KeyEvent.KEYCODE_BACK: {
+ if (event.getAction() == KeyEvent.ACTION_UP) {
+ mBar.animateCollapse();
+ }
+ return true;
+ }
+ // We react to the home key but let the system handle it.
+ case KeyEvent.KEYCODE_HOME: {
+ if (event.getAction() == KeyEvent.ACTION_UP) {
+ mBar.animateCollapse();
+ }
+ } break;
+ }
+ return super.dispatchKeyEvent(event);
+ }
+
/*
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {