diff options
| -rw-r--r-- | api/current.xml | 22 | ||||
| -rw-r--r-- | core/java/android/app/Activity.java | 42 | ||||
| -rw-r--r-- | core/java/android/app/ActivityManagerNative.java | 66 | ||||
| -rw-r--r-- | core/java/android/app/IActivityManager.java | 4 | ||||
| -rw-r--r-- | core/java/android/app/Notification.java | 13 | ||||
| -rw-r--r-- | core/java/android/content/pm/ActivityInfo.java | 17 | ||||
| -rw-r--r-- | core/java/android/content/pm/PackageParser.java | 6 | ||||
| -rw-r--r-- | packages/SystemUI/res/layout/intruder_alert.xml | 58 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java | 94 | ||||
| -rw-r--r-- | services/java/com/android/server/am/ActivityManagerService.java | 29 | ||||
| -rw-r--r-- | services/java/com/android/server/am/ActivityRecord.java | 5 | ||||
| -rw-r--r-- | tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java | 15 |
12 files changed, 12 insertions, 359 deletions
diff --git a/api/current.xml b/api/current.xml index bfd6e60..89d769e 100644 --- a/api/current.xml +++ b/api/current.xml @@ -26633,17 +26633,6 @@ visibility="public" > </field> -<field name="FLAG_HIGH_PRIORITY" - type="int" - transient="false" - volatile="false" - value="128" - static="true" - final="true" - deprecated="not deprecated" - visibility="public" -> -</field> <field name="FLAG_INSISTENT" type="int" transient="false" @@ -46071,17 +46060,6 @@ visibility="public" > </field> -<field name="FLAG_IMMERSIVE" - type="int" - transient="false" - volatile="false" - value="512" - static="true" - final="true" - deprecated="not deprecated" - visibility="public" -> -</field> <field name="FLAG_MULTIPROCESS" type="int" transient="false" diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 773ff7c..f7a9a18 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -3740,48 +3740,6 @@ public class Activity extends ContextThemeWrapper return null; } - /** - * Bit indicating that this activity is "immersive" and should not be - * interrupted by notifications if possible. - * - * This value is initially set by the manifest property - * <code>android:immersive</code> but may be changed at runtime by - * {@link #setImmersive}. - * - * @see android.content.pm.ActivityInfo#FLAG_IMMERSIVE - * @hide - */ - public boolean isImmersive() { - try { - return ActivityManagerNative.getDefault().isImmersive(mToken); - } catch (RemoteException e) { - return false; - } - } - - /** - * Adjust the current immersive mode setting. - * - * Note that changing this value will have no effect on the activity's - * {@link android.content.pm.ActivityInfo} structure; that is, if - * <code>android:immersive</code> is set to <code>true</code> - * in the application's manifest entry for this activity, the {@link - * android.content.pm.ActivityInfo#flags ActivityInfo.flags} member will - * always have its {@link android.content.pm.ActivityInfo#FLAG_IMMERSIVE - * FLAG_IMMERSIVE} bit set. - * - * @see #isImmersive - * @see android.content.pm.ActivityInfo#FLAG_IMMERSIVE - * @hide - */ - public void setImmersive(boolean i) { - try { - ActivityManagerNative.getDefault().setImmersive(mToken, i); - } catch (RemoteException e) { - // pass - } - } - // ------------------ Internal API ------------------ final void setParent(Activity parent) { diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index 1d1b4dc..a180837 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -1261,32 +1261,6 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } - case IS_IMMERSIVE_TRANSACTION: { - data.enforceInterface(IActivityManager.descriptor); - IBinder token = data.readStrongBinder(); - boolean isit = isImmersive(token); - reply.writeNoException(); - reply.writeInt(isit ? 1 : 0); - return true; - } - - case SET_IMMERSIVE_TRANSACTION: { - data.enforceInterface(IActivityManager.descriptor); - IBinder token = data.readStrongBinder(); - boolean imm = data.readInt() == 1; - setImmersive(token, imm); - reply.writeNoException(); - return true; - } - - case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: { - data.enforceInterface(IActivityManager.descriptor); - boolean isit = isTopActivityImmersive(); - reply.writeNoException(); - reply.writeInt(isit ? 1 : 0); - return true; - } - case CRASH_APPLICATION_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int uid = data.readInt(); @@ -2858,46 +2832,6 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); } - public void setImmersive(IBinder token, boolean immersive) - throws RemoteException { - Parcel data = Parcel.obtain(); - Parcel reply = Parcel.obtain(); - data.writeInterfaceToken(IActivityManager.descriptor); - data.writeStrongBinder(token); - data.writeInt(immersive ? 1 : 0); - mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0); - reply.readException(); - data.recycle(); - reply.recycle(); - } - - public boolean isImmersive(IBinder token) - throws RemoteException { - Parcel data = Parcel.obtain(); - Parcel reply = Parcel.obtain(); - data.writeInterfaceToken(IActivityManager.descriptor); - data.writeStrongBinder(token); - mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0); - reply.readException(); - boolean res = reply.readInt() == 1; - data.recycle(); - reply.recycle(); - return res; - } - - public boolean isTopActivityImmersive() - throws RemoteException { - Parcel data = Parcel.obtain(); - Parcel reply = Parcel.obtain(); - data.writeInterfaceToken(IActivityManager.descriptor); - mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0); - reply.readException(); - boolean res = reply.readInt() == 1; - data.recycle(); - reply.recycle(); - return res; - } - public void crashApplication(int uid, int initialPid, String packageName, String message) throws RemoteException { Parcel data = Parcel.obtain(); diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java index 664cf18..f9bd461 100644 --- a/core/java/android/app/IActivityManager.java +++ b/core/java/android/app/IActivityManager.java @@ -311,10 +311,6 @@ public interface IActivityManager extends IInterface { public void finishHeavyWeightApp() throws RemoteException; - public void setImmersive(IBinder token, boolean immersive) throws RemoteException; - public boolean isImmersive(IBinder token) throws RemoteException; - public boolean isTopActivityImmersive() throws RemoteException; - public void crashApplication(int uid, int initialPid, String packageName, String message) throws RemoteException; diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 83a2024..5525ce3 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -112,8 +112,6 @@ public class Notification implements Parcelable * An intent to launch instead of posting the notification to the status bar. Only for use with * extremely high-priority notifications demanding the user's attention, such as an incoming * call (handled in the core Android Phone app with a full-screen Activity). - * Use with {@link #FLAG_HIGH_PRIORITY} to ensure that this notification will reach the user - * even when other notifications are suppressed. */ public PendingIntent fullScreenIntent; @@ -273,14 +271,6 @@ public class Notification implements Parcelable */ public static final int FLAG_FOREGROUND_SERVICE = 0x00000040; - /** - * Bit to be bitwise-ored into the {@link #flags} field that should be set if this notification - * represents a high-priority event that may be shown to the user even if notifications are - * otherwise unavailable (that is, when the status bar is hidden). This flag is ideally used - * in conjunction with {@link #fullScreenIntent}. - */ - public static final int FLAG_HIGH_PRIORITY = 0x00000080; - public int flags; /** @@ -549,9 +539,6 @@ public class Notification implements Parcelable sb.append(Integer.toHexString(this.defaults)); sb.append(",flags=0x"); sb.append(Integer.toHexString(this.flags)); - if ((this.flags & FLAG_HIGH_PRIORITY) != 0) { - sb.append("!!!1!one!"); - } sb.append(")"); return sb.toString(); } diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java index 364c91e..395c392 100644 --- a/core/java/android/content/pm/ActivityInfo.java +++ b/core/java/android/content/pm/ActivityInfo.java @@ -149,22 +149,6 @@ public class ActivityInfo extends ComponentInfo * {@link android.R.attr#finishOnCloseSystemDialogs} attribute. */ public static final int FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS = 0x0100; - /** - * Bit in {@link #flags} corresponding to an immersive activity - * that wishes not to be interrupted by notifications. - * Applications that hide the system notification bar with - * {@link android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN} - * may still be interrupted by high-priority notifications; for example, an - * incoming phone call may use - * {@link android.app.Notification#fullScreenIntent fullScreenIntent} - * to present a full-screen in-call activity to the user, pausing the - * current activity as a side-effect. An activity with - * {@link #FLAG_IMMERSIVE} set, however, will not be interrupted; the - * notification may be shown in some other way (such as a small floating - * "toast" window). - * {@see android.app.Notification#FLAG_HIGH_PRIORITY} - */ - public static final int FLAG_IMMERSIVE = 0x0200; /** * Options that have been set in the activity declaration in the * manifest. @@ -175,7 +159,6 @@ public class ActivityInfo extends ComponentInfo * {@link #FLAG_STATE_NOT_NEEDED}, {@link #FLAG_EXCLUDE_FROM_RECENTS}, * {@link #FLAG_ALLOW_TASK_REPARENTING}, {@link #FLAG_NO_HISTORY}, * {@link #FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS}, - * {@link #FLAG_IMMERSIVE} */ public int flags; diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 2a39dc0..e20cb5e 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -1883,12 +1883,6 @@ public class PackageParser { a.info.flags |= ActivityInfo.FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS; } - if (sa.getBoolean( - com.android.internal.R.styleable.AndroidManifestActivity_immersive, - false)) { - a.info.flags |= ActivityInfo.FLAG_IMMERSIVE; - } - if (!receiver) { a.info.launchMode = sa.getInt( com.android.internal.R.styleable.AndroidManifestActivity_launchMode, diff --git a/packages/SystemUI/res/layout/intruder_alert.xml b/packages/SystemUI/res/layout/intruder_alert.xml deleted file mode 100644 index ba4a774..0000000 --- a/packages/SystemUI/res/layout/intruder_alert.xml +++ /dev/null @@ -1,58 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* apps/common/assets/default/default/skins/StatusBar.xml -** -** Copyright 2006, 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. -*/ ---> - -<!-- android:background="@drawable/status_bar_closed_default_background" --> -<FrameLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_height="32dip" - android:layout_width="match_parent" - android:paddingLeft="8dip" - android:paddingRight="8dip" - > - - <LinearLayout - android:id="@+id/intruder_alert_content" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:gravity="center" - android:animationCache="false" - android:orientation="horizontal" - android:background="@drawable/alert_bar_background" - android:clickable="true" - android:focusable="true" - android:descendantFocusability="afterDescendants" - > - - <ImageView - android:id="@+id/alertIcon" - android:layout_width="25dip" - android:layout_height="25dip" - android:layout_marginLeft="6dip" - android:layout_marginRight="8dip" - /> - <TextView - android:id="@+id/alertText" - android:textAppearance="@style/TextAppearance.StatusBar.IntruderAlert" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:singleLine="true" - /> - </LinearLayout> -</FrameLayout> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java index a47415e..8f2da7a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java @@ -91,11 +91,6 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks private static final int MSG_ANIMATE = 1000; private static final int MSG_ANIMATE_REVEAL = 1001; - private static final int MSG_SHOW_INTRUDER = 1002; - private static final int MSG_HIDE_INTRUDER = 1003; - - // will likely move to a resource or other tunable param at some point - private static final int INTRUDER_ALERT_DECAY_MS = 10000; StatusBarPolicy mIconPolicy; @@ -247,9 +242,6 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks // we're never destroyed } - // for immersive activities - private View mIntruderAlertView; - /** * Nobody binds to us. */ @@ -270,10 +262,6 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks R.layout.status_bar_expanded, null); expanded.mService = this; - mIntruderAlertView = View.inflate(context, R.layout.intruder_alert, null); - mIntruderAlertView.setVisibility(View.GONE); - mIntruderAlertView.setClickable(true); - StatusBarView sb = (StatusBarView)View.inflate(context, R.layout.status_bar, null); sb.mService = this; @@ -354,23 +342,6 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks // TODO lp.windowAnimations = R.style.Animation_StatusBar; WindowManagerImpl.getDefault().addView(view, lp); - - lp = new WindowManager.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.WRAP_CONTENT, - WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL, - WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN - | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS - | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL - | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE - | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM, - PixelFormat.TRANSLUCENT); - lp.gravity = Gravity.TOP | Gravity.FILL_HORIZONTAL; - lp.y += height * 1.5; // FIXME - lp.setTitle("IntruderAlert"); - lp.windowAnimations = com.android.internal.R.style.Animation_StatusBar_IntruderAlert; - - WindowManagerImpl.getDefault().addView(mIntruderAlertView, lp); } public void addIcon(String slot, int index, int viewIndex, StatusBarIcon icon) { @@ -395,55 +366,23 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks } public void addNotification(IBinder key, StatusBarNotification notification) { - StatusBarIconView iconView = addNotificationViews(key, notification); - if (iconView == null) return; - - boolean immersive = false; - try { - immersive = ActivityManagerNative.getDefault().isTopActivityImmersive(); - Slog.d(TAG, "Top activity is " + (immersive?"immersive":"not immersive")); - } catch (RemoteException ex) { - } - if (immersive) { - if ((notification.notification.flags & Notification.FLAG_HIGH_PRIORITY) != 0) { - Slog.d(TAG, "Presenting high-priority notification in immersive activity"); - // @@@ special new transient ticker mode - // 1. Populate mIntruderAlertView - - ImageView alertIcon = (ImageView) mIntruderAlertView.findViewById(R.id.alertIcon); - TextView alertText = (TextView) mIntruderAlertView.findViewById(R.id.alertText); - alertIcon.setImageDrawable(StatusBarIconView.getIcon( - alertIcon.getContext(), - iconView.getStatusBarIcon())); - alertText.setText(notification.notification.tickerText); - - View button = mIntruderAlertView.findViewById(R.id.intruder_alert_content); - button.setOnClickListener( - new Launcher(notification.notification.contentIntent, - notification.pkg, notification.tag, notification.id)); - - // 2. Animate mIntruderAlertView in - mHandler.sendEmptyMessage(MSG_SHOW_INTRUDER); - - // 3. Set alarm to age the notification off (TODO) - mHandler.removeMessages(MSG_HIDE_INTRUDER); - mHandler.sendEmptyMessageDelayed(MSG_HIDE_INTRUDER, INTRUDER_ALERT_DECAY_MS); - } - } else if (notification.notification.fullScreenIntent != null) { - // not immersive & a full-screen alert should be shown - Slog.d(TAG, "Notification has fullScreenIntent and activity is not immersive;" - + " sending fullScreenIntent"); + boolean shouldTick = true; + if (notification.notification.fullScreenIntent != null) { + shouldTick = false; + Slog.d(TAG, "Notification has fullScreenIntent; sending fullScreenIntent"); try { notification.notification.fullScreenIntent.send(); } catch (PendingIntent.CanceledException e) { } - } else { - // usual case: status bar visible & not immersive + } + + StatusBarIconView iconView = addNotificationViews(key, notification); + if (iconView == null) return; - // show the ticker + if (shouldTick) { tick(notification); } - + // Recalculate the position of the sliding windows and the titles. setAreThereNotifications(); updateExpandedViewPos(EXPANDED_LEAVE_ALONE); @@ -721,12 +660,6 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks case MSG_ANIMATE_REVEAL: doRevealAnimation(); break; - case MSG_SHOW_INTRUDER: - setIntruderAlertVisibility(true); - break; - case MSG_HIDE_INTRUDER: - setIntruderAlertVisibility(false); - break; } } } @@ -1109,9 +1042,6 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks // close the shade if it was open animateCollapse(); - - // If this click was on the intruder alert, hide that instead - mHandler.sendEmptyMessage(MSG_HIDE_INTRUDER); } } @@ -1548,10 +1478,6 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks } }; - private void setIntruderAlertVisibility(boolean vis) { - mIntruderAlertView.setVisibility(vis ? View.VISIBLE : View.GONE); - } - /** * Reload some of our resources when the configuration changes. * diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index d535343..5d5e862 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -5687,35 +5687,6 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } } - public void setImmersive(IBinder token, boolean immersive) { - synchronized(this) { - int index = (token != null) ? mMainStack.indexOfTokenLocked(token) : -1; - if (index < 0) { - throw new IllegalArgumentException(); - } - ActivityRecord r = (ActivityRecord)mMainStack.mHistory.get(index); - r.immersive = immersive; - } - } - - public boolean isImmersive(IBinder token) { - synchronized (this) { - int index = (token != null) ? mMainStack.indexOfTokenLocked(token) : -1; - if (index < 0) { - throw new IllegalArgumentException(); - } - ActivityRecord r = (ActivityRecord)mMainStack.mHistory.get(index); - return r.immersive; - } - } - - public boolean isTopActivityImmersive() { - synchronized (this) { - ActivityRecord r = mMainStack.topRunningActivityLocked(null); - return (r != null) ? r.immersive : false; - } - } - public final void enterSafeMode() { synchronized(this) { // It only makes sense to do this before the system is ready diff --git a/services/java/com/android/server/am/ActivityRecord.java b/services/java/com/android/server/am/ActivityRecord.java index 62be918..1687db1 100644 --- a/services/java/com/android/server/am/ActivityRecord.java +++ b/services/java/com/android/server/am/ActivityRecord.java @@ -103,7 +103,6 @@ class ActivityRecord extends IApplicationToken.Stub { boolean idle; // has the activity gone idle? boolean hasBeenLaunched;// has this activity ever been launched? boolean frozenBeforeDestroy;// has been frozen but not yet destroyed. - boolean immersive; // immersive mode (don't interrupt if possible) String stringName; // for caching of toString(). @@ -160,7 +159,6 @@ class ActivityRecord extends IApplicationToken.Stub { pw.print(prefix); pw.print("keysPaused="); pw.print(keysPaused); pw.print(" inHistory="); pw.print(inHistory); pw.print(" persistent="); pw.print(persistent); - pw.print(" immersive="); pw.print(immersive); pw.print(" launchMode="); pw.println(launchMode); pw.print(prefix); pw.print("fullscreen="); pw.print(fullscreen); pw.print(" visible="); pw.print(visible); @@ -287,8 +285,6 @@ class ActivityRecord extends IApplicationToken.Stub { } else { isHomeActivity = false; } - - immersive = (aInfo.flags & ActivityInfo.FLAG_IMMERSIVE) != 0; } else { realActivity = null; taskAffinity = null; @@ -300,7 +296,6 @@ class ActivityRecord extends IApplicationToken.Stub { packageName = null; fullscreen = true; isHomeActivity = false; - immersive = false; } } diff --git a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java index b665d2f..1078701 100644 --- a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java +++ b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java @@ -76,17 +76,7 @@ public class StatusBarTest extends TestActivity win.setAttributes(winParams); } }, - new Test("Immersive: Enter") { - public void run() { - setImmersive(true); - } - }, - new Test("Immersive: Exit") { - public void run() { - setImmersive(false); - } - }, - new Test("Priority notification") { + new Test("fullScreenIntent") { public void run() { Notification not = new Notification(StatusBarTest.this, R.drawable.stat_sys_phone, @@ -96,9 +86,8 @@ public class StatusBarTest extends TestActivity "(888) 555-5038", null ); - not.flags |= Notification.FLAG_HIGH_PRIORITY; Intent fullScreenIntent = new Intent(StatusBarTest.this, TestAlertActivity.class); - int id = (int)System.currentTimeMillis(); // XXX HAX + int id = (int)System.currentTimeMillis(); fullScreenIntent.putExtra("id", id); not.fullScreenIntent = PendingIntent.getActivity( StatusBarTest.this, |
