Remove experimental immersive mode support. DO NOT MERGE

Bug: 2949215

Change-Id: I7d998ef571ef7e149bb96261430e92150b80b77d
This commit is contained in:
Daniel Sandler
2010-08-26 10:28:46 -04:00
parent 7046bd924f
commit d02bdaab49
12 changed files with 12 additions and 359 deletions

View File

@ -26633,17 +26633,6 @@
visibility="public" visibility="public"
> >
</field> </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" <field name="FLAG_INSISTENT"
type="int" type="int"
transient="false" transient="false"
@ -46071,17 +46060,6 @@
visibility="public" visibility="public"
> >
</field> </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" <field name="FLAG_MULTIPROCESS"
type="int" type="int"
transient="false" transient="false"

View File

@ -3740,48 +3740,6 @@ public class Activity extends ContextThemeWrapper
return null; 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 ------------------ // ------------------ Internal API ------------------
final void setParent(Activity parent) { final void setParent(Activity parent) {

View File

@ -1261,32 +1261,6 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
return true; 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: { case CRASH_APPLICATION_TRANSACTION: {
data.enforceInterface(IActivityManager.descriptor); data.enforceInterface(IActivityManager.descriptor);
int uid = data.readInt(); int uid = data.readInt();
@ -2858,46 +2832,6 @@ class ActivityManagerProxy implements IActivityManager
reply.recycle(); 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, public void crashApplication(int uid, int initialPid, String packageName,
String message) throws RemoteException { String message) throws RemoteException {
Parcel data = Parcel.obtain(); Parcel data = Parcel.obtain();

View File

@ -311,10 +311,6 @@ public interface IActivityManager extends IInterface {
public void finishHeavyWeightApp() throws RemoteException; 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, public void crashApplication(int uid, int initialPid, String packageName,
String message) throws RemoteException; String message) throws RemoteException;

View File

@ -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 * 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 * 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). * 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; public PendingIntent fullScreenIntent;
@ -273,14 +271,6 @@ public class Notification implements Parcelable
*/ */
public static final int FLAG_FOREGROUND_SERVICE = 0x00000040; 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; public int flags;
/** /**
@ -549,9 +539,6 @@ public class Notification implements Parcelable
sb.append(Integer.toHexString(this.defaults)); sb.append(Integer.toHexString(this.defaults));
sb.append(",flags=0x"); sb.append(",flags=0x");
sb.append(Integer.toHexString(this.flags)); sb.append(Integer.toHexString(this.flags));
if ((this.flags & FLAG_HIGH_PRIORITY) != 0) {
sb.append("!!!1!one!");
}
sb.append(")"); sb.append(")");
return sb.toString(); return sb.toString();
} }

View File

@ -149,22 +149,6 @@ public class ActivityInfo extends ComponentInfo
* {@link android.R.attr#finishOnCloseSystemDialogs} attribute. * {@link android.R.attr#finishOnCloseSystemDialogs} attribute.
*/ */
public static final int FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS = 0x0100; 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 * Options that have been set in the activity declaration in the
* manifest. * manifest.
@ -175,7 +159,6 @@ public class ActivityInfo extends ComponentInfo
* {@link #FLAG_STATE_NOT_NEEDED}, {@link #FLAG_EXCLUDE_FROM_RECENTS}, * {@link #FLAG_STATE_NOT_NEEDED}, {@link #FLAG_EXCLUDE_FROM_RECENTS},
* {@link #FLAG_ALLOW_TASK_REPARENTING}, {@link #FLAG_NO_HISTORY}, * {@link #FLAG_ALLOW_TASK_REPARENTING}, {@link #FLAG_NO_HISTORY},
* {@link #FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS}, * {@link #FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS},
* {@link #FLAG_IMMERSIVE}
*/ */
public int flags; public int flags;

View File

@ -1883,12 +1883,6 @@ public class PackageParser {
a.info.flags |= ActivityInfo.FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS; 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) { if (!receiver) {
a.info.launchMode = sa.getInt( a.info.launchMode = sa.getInt(
com.android.internal.R.styleable.AndroidManifestActivity_launchMode, com.android.internal.R.styleable.AndroidManifestActivity_launchMode,

View File

@ -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>

View File

@ -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 = 1000;
private static final int MSG_ANIMATE_REVEAL = 1001; 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; StatusBarPolicy mIconPolicy;
@ -247,9 +242,6 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks
// we're never destroyed // we're never destroyed
} }
// for immersive activities
private View mIntruderAlertView;
/** /**
* Nobody binds to us. * Nobody binds to us.
*/ */
@ -270,10 +262,6 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks
R.layout.status_bar_expanded, null); R.layout.status_bar_expanded, null);
expanded.mService = this; 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); StatusBarView sb = (StatusBarView)View.inflate(context, R.layout.status_bar, null);
sb.mService = this; sb.mService = this;
@ -354,23 +342,6 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks
// TODO lp.windowAnimations = R.style.Animation_StatusBar; // TODO lp.windowAnimations = R.style.Animation_StatusBar;
WindowManagerImpl.getDefault().addView(view, lp); 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) { 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) { public void addNotification(IBinder key, StatusBarNotification notification) {
StatusBarIconView iconView = addNotificationViews(key, notification); boolean shouldTick = true;
if (iconView == null) return; if (notification.notification.fullScreenIntent != null) {
shouldTick = false;
boolean immersive = false; Slog.d(TAG, "Notification has fullScreenIntent; sending fullScreenIntent");
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");
try { try {
notification.notification.fullScreenIntent.send(); notification.notification.fullScreenIntent.send();
} catch (PendingIntent.CanceledException e) { } catch (PendingIntent.CanceledException e) {
} }
} else { }
// usual case: status bar visible & not immersive
// show the ticker StatusBarIconView iconView = addNotificationViews(key, notification);
if (iconView == null) return;
if (shouldTick) {
tick(notification); tick(notification);
} }
// Recalculate the position of the sliding windows and the titles. // Recalculate the position of the sliding windows and the titles.
setAreThereNotifications(); setAreThereNotifications();
updateExpandedViewPos(EXPANDED_LEAVE_ALONE); updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
@ -721,12 +660,6 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks
case MSG_ANIMATE_REVEAL: case MSG_ANIMATE_REVEAL:
doRevealAnimation(); doRevealAnimation();
break; 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 // close the shade if it was open
animateCollapse(); 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. * Reload some of our resources when the configuration changes.
* *

View File

@ -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() { public final void enterSafeMode() {
synchronized(this) { synchronized(this) {
// It only makes sense to do this before the system is ready // It only makes sense to do this before the system is ready

View File

@ -103,7 +103,6 @@ class ActivityRecord extends IApplicationToken.Stub {
boolean idle; // has the activity gone idle? boolean idle; // has the activity gone idle?
boolean hasBeenLaunched;// has this activity ever been launched? boolean hasBeenLaunched;// has this activity ever been launched?
boolean frozenBeforeDestroy;// has been frozen but not yet destroyed. boolean frozenBeforeDestroy;// has been frozen but not yet destroyed.
boolean immersive; // immersive mode (don't interrupt if possible)
String stringName; // for caching of toString(). 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(prefix); pw.print("keysPaused="); pw.print(keysPaused);
pw.print(" inHistory="); pw.print(inHistory); pw.print(" inHistory="); pw.print(inHistory);
pw.print(" persistent="); pw.print(persistent); pw.print(" persistent="); pw.print(persistent);
pw.print(" immersive="); pw.print(immersive);
pw.print(" launchMode="); pw.println(launchMode); pw.print(" launchMode="); pw.println(launchMode);
pw.print(prefix); pw.print("fullscreen="); pw.print(fullscreen); pw.print(prefix); pw.print("fullscreen="); pw.print(fullscreen);
pw.print(" visible="); pw.print(visible); pw.print(" visible="); pw.print(visible);
@ -287,8 +285,6 @@ class ActivityRecord extends IApplicationToken.Stub {
} else { } else {
isHomeActivity = false; isHomeActivity = false;
} }
immersive = (aInfo.flags & ActivityInfo.FLAG_IMMERSIVE) != 0;
} else { } else {
realActivity = null; realActivity = null;
taskAffinity = null; taskAffinity = null;
@ -300,7 +296,6 @@ class ActivityRecord extends IApplicationToken.Stub {
packageName = null; packageName = null;
fullscreen = true; fullscreen = true;
isHomeActivity = false; isHomeActivity = false;
immersive = false;
} }
} }

View File

@ -76,17 +76,7 @@ public class StatusBarTest extends TestActivity
win.setAttributes(winParams); win.setAttributes(winParams);
} }
}, },
new Test("Immersive: Enter") { new Test("fullScreenIntent") {
public void run() {
setImmersive(true);
}
},
new Test("Immersive: Exit") {
public void run() {
setImmersive(false);
}
},
new Test("Priority notification") {
public void run() { public void run() {
Notification not = new Notification(StatusBarTest.this, Notification not = new Notification(StatusBarTest.this,
R.drawable.stat_sys_phone, R.drawable.stat_sys_phone,
@ -96,9 +86,8 @@ public class StatusBarTest extends TestActivity
"(888) 555-5038", "(888) 555-5038",
null null
); );
not.flags |= Notification.FLAG_HIGH_PRIORITY;
Intent fullScreenIntent = new Intent(StatusBarTest.this, TestAlertActivity.class); Intent fullScreenIntent = new Intent(StatusBarTest.this, TestAlertActivity.class);
int id = (int)System.currentTimeMillis(); // XXX HAX int id = (int)System.currentTimeMillis();
fullScreenIntent.putExtra("id", id); fullScreenIntent.putExtra("id", id);
not.fullScreenIntent = PendingIntent.getActivity( not.fullScreenIntent = PendingIntent.getActivity(
StatusBarTest.this, StatusBarTest.this,