Merge "Force clipping on layers that fail to be allocated" into jb-mr2-dev
diff --git a/api/current.txt b/api/current.txt
index 9125fa5..3418761 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -6473,7 +6473,6 @@
field public static final android.os.Parcelable.Creator CREATOR;
field public static final int TYPE_BOOLEAN = 1; // 0x1
field public static final int TYPE_CHOICE = 2; // 0x2
- field public static final int TYPE_CHOICE_LEVEL = 3; // 0x3
field public static final int TYPE_MULTI_SELECT = 4; // 0x4
field public static final int TYPE_NULL = 0; // 0x0
}
@@ -17644,7 +17643,6 @@
method public java.lang.String getUserName();
method public android.os.Bundle getUserRestrictions();
method public android.os.Bundle getUserRestrictions(android.os.UserHandle);
- method public boolean isLinkedUser();
method public boolean isUserAGoat();
method public boolean isUserRunning(android.os.UserHandle);
method public boolean isUserRunningOrStopping(android.os.UserHandle);
@@ -21229,8 +21227,9 @@
public abstract class NotificationListenerService extends android.app.Service {
ctor public NotificationListenerService();
- method public final void clearAllNotifications();
- method public final void clearNotification(java.lang.String, java.lang.String, int);
+ method public final void cancelAllNotifications();
+ method public final void cancelNotification(java.lang.String, java.lang.String, int);
+ method public android.service.notification.StatusBarNotification[] getActiveNotifications();
method public android.os.IBinder onBind(android.content.Intent);
method public abstract void onNotificationPosted(android.service.notification.StatusBarNotification);
method public abstract void onNotificationRemoved(android.service.notification.StatusBarNotification);
@@ -21242,17 +21241,16 @@
ctor public StatusBarNotification(android.os.Parcel);
method public android.service.notification.StatusBarNotification clone();
method public int describeContents();
+ method public int getId();
+ method public android.app.Notification getNotification();
+ method public java.lang.String getPackageName();
+ method public long getPostTime();
+ method public java.lang.String getTag();
method public int getUserId();
method public boolean isClearable();
method public boolean isOngoing();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
- field public final int id;
- field public final android.app.Notification notification;
- field public final java.lang.String pkg;
- field public final long postTime;
- field public final java.lang.String tag;
- field public final android.os.UserHandle user;
}
}
diff --git a/cmds/app_process/app_main.cpp b/cmds/app_process/app_main.cpp
index 90bcb0fb..28752a5 100644
--- a/cmds/app_process/app_main.cpp
+++ b/cmds/app_process/app_main.cpp
@@ -7,6 +7,7 @@
#define LOG_TAG "appproc"
+#include <cutils/properties.h>
#include <binder/IPCThreadState.h>
#include <binder/ProcessState.h>
#include <utils/Log.h>
@@ -148,7 +149,10 @@
* This breaks some programs which improperly embed
* an out of date copy of Android's linker.
*/
- if (getenv("NO_ADDR_COMPAT_LAYOUT_FIXUP") == NULL) {
+ char value[PROPERTY_VALUE_MAX];
+ property_get("ro.kernel.qemu", value, "");
+ bool is_qemu = (strcmp(value, "1") == 0);
+ if ((getenv("NO_ADDR_COMPAT_LAYOUT_FIXUP") == NULL) && !is_qemu) {
int current = personality(0xFFFFFFFF);
if ((current & ADDR_COMPAT_LAYOUT) == 0) {
personality(current | ADDR_COMPAT_LAYOUT);
diff --git a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
index 7e21db3..de58a33 100644
--- a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
+++ b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
@@ -378,23 +378,6 @@
/**
* Creates a new instance.
*
- * @param isAutomation Whether this is a test automation service.
- *
- * @hide
- */
- public AccessibilityServiceInfo(boolean isAutomation) {
- // Automation service can do anything.
- if (isAutomation) {
- mCapabilities |= CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT
- | CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION
- | CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY
- | CAPABILITY_CAN_REQUEST_FILTER_KEY_EVENTS;
- }
- }
-
- /**
- * Creates a new instance.
- *
* @param resolveInfo The service resolve info.
* @param context Context for accessing resources.
* @throws XmlPullParserException If a XML parsing error occurs.
@@ -461,8 +444,8 @@
mCapabilities |= CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION;
}
if (asAttributes.getBoolean(com.android.internal.R.styleable
- .AccessibilityService_canRequestEnhancedWebAccessibility, false)) {
- mCapabilities |= CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY;
+ .AccessibilityService_canRequestEnhancedWebAccessibility, false)) {
+ mCapabilities |= CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY;
}
if (asAttributes.getBoolean(com.android.internal.R.styleable
.AccessibilityService_canRequestFilterKeyEvents, false)) {
@@ -574,6 +557,23 @@
}
/**
+ * Sets the bit mask of capabilities this accessibility service has such as
+ * being able to retrieve the active window content, etc.
+ *
+ * @param capabilities The capability bit mask.
+ *
+ * @see #CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT
+ * @see #CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION
+ * @see #CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY
+ * @see #CAPABILITY_FILTER_KEY_EVENTS
+ *
+ * @hide
+ */
+ public void setCapabilities(int capabilities) {
+ mCapabilities = capabilities;
+ }
+
+ /**
* Gets the non-localized description of the accessibility service.
* <p>
* <strong>Statically set from
diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl
index 92ec3ad..9f933ca 100644
--- a/core/java/android/app/INotificationManager.aidl
+++ b/core/java/android/app/INotificationManager.aidl
@@ -44,6 +44,8 @@
void registerListener(in INotificationListener listener, in ComponentName component, int userid);
void unregisterListener(in INotificationListener listener, int userid);
- void clearNotificationFromListener(in INotificationListener token, String pkg, String tag, int id);
- void clearAllNotificationsFromListener(in INotificationListener token);
+ void cancelNotificationFromListener(in INotificationListener token, String pkg, String tag, int id);
+ void cancelAllNotificationsFromListener(in INotificationListener token);
+
+ StatusBarNotification[] getActiveNotificationsFromListener(in INotificationListener token);
}
\ No newline at end of file
diff --git a/core/java/android/app/UiAutomationConnection.java b/core/java/android/app/UiAutomationConnection.java
index 5bc17fa..607930c 100644
--- a/core/java/android/app/UiAutomationConnection.java
+++ b/core/java/android/app/UiAutomationConnection.java
@@ -158,11 +158,15 @@
private void registerUiTestAutomationServiceLocked(IAccessibilityServiceClient client) {
IAccessibilityManager manager = IAccessibilityManager.Stub.asInterface(
ServiceManager.getService(Context.ACCESSIBILITY_SERVICE));
- AccessibilityServiceInfo info = new AccessibilityServiceInfo(true);
+ AccessibilityServiceInfo info = new AccessibilityServiceInfo();
info.eventTypes = AccessibilityEvent.TYPES_ALL_MASK;
info.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC;
info.flags |= AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS
| AccessibilityServiceInfo.FLAG_REPORT_VIEW_IDS;
+ info.setCapabilities(AccessibilityServiceInfo.CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT
+ | AccessibilityServiceInfo.CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION
+ | AccessibilityServiceInfo.CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY
+ | AccessibilityServiceInfo.CAPABILITY_CAN_REQUEST_FILTER_KEY_EVENTS);
try {
// Calling out with a lock held is fine since if the system
// process is gone the client calling in will be killed.
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index 3498bb8..cfbfb48 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -1434,7 +1434,7 @@
* <p>Results of the scan are reported using the
* {@link LeScanCallback#onLeScan} callback.
*
- * <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission.
+ * <p>Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission.
*
* @param callback the callback LE scan results are delivered
* @return true, if the scan was started successfully
@@ -1450,7 +1450,7 @@
* <p>Devices which advertise all specified services are reported using the
* {@link LeScanCallback#onLeScan} callback.
*
- * <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission.
+ * <p>Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission.
*
* @param serviceUuids Array of services to look for
* @param callback the callback LE scan results are delivered
@@ -1490,7 +1490,7 @@
/**
* Stops an ongoing Bluetooth LE device scan.
*
- * <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission.
+ * <p>Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission.
*
* @param callback used to identify which scan to stop
* must be the same handle used to start the scan
diff --git a/core/java/android/bluetooth/BluetoothOutputStream.java b/core/java/android/bluetooth/BluetoothOutputStream.java
index 62242a2..117dd47 100644
--- a/core/java/android/bluetooth/BluetoothOutputStream.java
+++ b/core/java/android/bluetooth/BluetoothOutputStream.java
@@ -84,4 +84,15 @@
}
mSocket.write(b, offset, count);
}
+ /**
+ * Wait until the data in sending queue is emptied. A polling version
+ * for flush implementation. Use it to ensure the writing data afterwards will
+ * be packed in the new RFCOMM frame.
+ * @throws IOException
+ * if an i/o error occurs.
+ * @since Android 4.2.3
+ */
+ public void flush() throws IOException {
+ mSocket.flush();
+ }
}
diff --git a/core/java/android/bluetooth/BluetoothSocket.java b/core/java/android/bluetooth/BluetoothSocket.java
index 8029a1a..a19341c 100644
--- a/core/java/android/bluetooth/BluetoothSocket.java
+++ b/core/java/android/bluetooth/BluetoothSocket.java
@@ -192,6 +192,7 @@
if (VDBG) Log.d(TAG, "socket fd passed by stack fds: " + fds);
if(fds == null || fds.length != 1) {
Log.e(TAG, "socket fd passed from stack failed, fds: " + fds);
+ as.close();
throw new IOException("bt socket acept failed");
}
as.mSocket = new LocalSocket(fds[0]);
@@ -407,6 +408,17 @@
if (VDBG) Log.d(TAG, "available: " + mSocketIS);
return mSocketIS.available();
}
+ /**
+ * Wait until the data in sending queue is emptied. A polling version
+ * for flush implementation. Used to ensure the writing data afterwards will
+ * be packed in new RFCOMM frame.
+ * @throws IOException
+ * if an i/o error occurs.
+ */
+ /*package*/ void flush() throws IOException {
+ if (VDBG) Log.d(TAG, "flush: " + mSocketOS);
+ mSocketOS.flush();
+ }
/*package*/ int read(byte[] b, int offset, int length) throws IOException {
diff --git a/core/java/android/content/RestrictionEntry.java b/core/java/android/content/RestrictionEntry.java
index af90385..217cf76 100644
--- a/core/java/android/content/RestrictionEntry.java
+++ b/core/java/android/content/RestrictionEntry.java
@@ -60,6 +60,7 @@
* and the corresponding values, respectively.
* The presentation could imply that values in lower array indices are included when a
* particular value is chosen.
+ * @hide
*/
public static final int TYPE_CHOICE_LEVEL = 3;
@@ -102,7 +103,7 @@
private String[] currentValues;
/**
- * Constructor for {@link #TYPE_CHOICE} and {@link #TYPE_CHOICE_LEVEL} types.
+ * Constructor for {@link #TYPE_CHOICE} type.
* @param key the unique key for this restriction
* @param selectedString the current value
*/
@@ -206,7 +207,7 @@
* shown to the user. Values will be chosen from this list as the user's selection and the
* selected values can be retrieved by a call to {@link #getAllSelectedStrings()}, or
* {@link #getSelectedString()}, depending on whether it is a multi-select type or choice type.
- * This method is not relevant for types other than {@link #TYPE_CHOICE_LEVEL},
+ * This method is not relevant for types other than
* {@link #TYPE_CHOICE}, and {@link #TYPE_MULTI_SELECT}.
* @param choiceValues an array of Strings which will be the selected values for the user's
* selections.
@@ -241,7 +242,7 @@
* user selects one or more of these choices, the corresponding value from the possible values
* are stored as the selected strings. The size of this array must match the size of the array
* set in {@link #setChoiceValues(String[])}. This method is not relevant for types other
- * than {@link #TYPE_CHOICE_LEVEL}, {@link #TYPE_CHOICE}, and {@link #TYPE_MULTI_SELECT}.
+ * than {@link #TYPE_CHOICE}, and {@link #TYPE_MULTI_SELECT}.
* @param choiceEntries the list of user-visible choices.
* @see #setChoiceValues(String[])
*/
diff --git a/core/java/android/net/LocalSocketImpl.java b/core/java/android/net/LocalSocketImpl.java
index 6c36a7d..8e129cb 100644
--- a/core/java/android/net/LocalSocketImpl.java
+++ b/core/java/android/net/LocalSocketImpl.java
@@ -136,8 +136,28 @@
write_native(b, myFd);
}
}
+
+ /**
+ * Wait until the data in sending queue is emptied. A polling version
+ * for flush implementation.
+ * @throws IOException
+ * if an i/o error occurs.
+ */
+ @Override
+ public void flush() throws IOException {
+ FileDescriptor myFd = fd;
+ if (myFd == null) throw new IOException("socket closed");
+ while(pending_native(fd) > 0) {
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException ie) {
+ return;
+ }
+ }
+ }
}
+ private native int pending_native(FileDescriptor fd) throws IOException;
private native int available_native(FileDescriptor fd) throws IOException;
private native void close_native(FileDescriptor fd) throws IOException;
private native int read_native(FileDescriptor fd) throws IOException;
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index df065e9..cb5ed4f 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -202,6 +202,7 @@
* Used to check if the user making this call is linked to another user. Linked users may have
* a reduced number of available apps, app restrictions and account restrictions.
* @return whether the user making this call is a linked user
+ * @hide
*/
public boolean isLinkedUser() {
try {
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java
index 8b72ca9..bfea9ca 100644
--- a/core/java/android/service/notification/NotificationListenerService.java
+++ b/core/java/android/service/notification/NotificationListenerService.java
@@ -25,6 +25,20 @@
import android.os.ServiceManager;
import android.util.Log;
+/**
+ * A service that receives calls from the system when new notifications are posted or removed.
+ * <p>To extend this class, you must declare the service in your manifest file with
+ * the {@link android.Manifest.permission#BIND_NOTIFICATION_LISTENER_SERVICE} permission
+ * and include an intent filter with the {@link #SERVICE_INTERFACE} action. For example:</p>
+ * <pre>
+ * <service android:name=".NotificationListener"
+ * android:label="@string/service_name"
+ * android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
+ * <intent-filter>
+ * <action android:name="android.service.notification.NotificationListenerService" />
+ * </intent-filter>
+ * </service></pre>
+ */
public abstract class NotificationListenerService extends Service {
// TAG = "NotificationListenerService[MySubclass]"
private final String TAG = NotificationListenerService.class.getSimpleName()
@@ -57,7 +71,7 @@
* notification listener) or because the app has withdrawn the notification.
* <P>
* NOTE: The {@link StatusBarNotification} object you receive will be "light"; that is, the
- * {@link StatusBarNotification#notification} member may be missing some heavyweight
+ * result from {@link StatusBarNotification#getNotification} may be missing some heavyweight
* fields such as {@link android.app.Notification#contentView} and
* {@link android.app.Notification#largeIcon}. However, all other fields on
* {@link StatusBarNotification}, sufficient to match this call with a prior call to
@@ -97,9 +111,9 @@
* @param id ID of the notification as specified by the notifying app in
* {@link android.app.NotificationManager#notify(String, int, android.app.Notification)}.
*/
- public final void clearNotification(String pkg, String tag, int id) {
+ public final void cancelNotification(String pkg, String tag, int id) {
try {
- getNotificationInterface().clearNotificationFromListener(mWrapper, pkg, tag, id);
+ getNotificationInterface().cancelNotificationFromListener(mWrapper, pkg, tag, id);
} catch (android.os.RemoteException ex) {
Log.v(TAG, "Unable to contact notification manager", ex);
}
@@ -114,16 +128,31 @@
* upon being informed, the notification manager will actually remove all active notifications
* and you will get multiple {@link #onNotificationRemoved(StatusBarNotification)} callbacks.
*
- * {@see #clearNotification(String, String, int)}
+ * {@see #cancelNotification(String, String, int)}
*/
- public final void clearAllNotifications() {
+ public final void cancelAllNotifications() {
try {
- getNotificationInterface().clearAllNotificationsFromListener(mWrapper);
+ getNotificationInterface().cancelAllNotificationsFromListener(mWrapper);
} catch (android.os.RemoteException ex) {
Log.v(TAG, "Unable to contact notification manager", ex);
}
}
+ /**
+ * Request the list of outstanding notifications (that is, those that are visible to the
+ * current user). Useful when starting up and you don't know what's already been posted.
+ *
+ * @return An array of active notifications.
+ */
+ public StatusBarNotification[] getActiveNotifications() {
+ try {
+ return getNotificationInterface().getActiveNotificationsFromListener(mWrapper);
+ } catch (android.os.RemoteException ex) {
+ Log.v(TAG, "Unable to contact notification manager", ex);
+ }
+ return null;
+ }
+
@Override
public IBinder onBind(Intent intent) {
if (mWrapper == null) {
diff --git a/core/java/android/service/notification/StatusBarNotification.java b/core/java/android/service/notification/StatusBarNotification.java
index 006518c..e8cc24b9 100644
--- a/core/java/android/service/notification/StatusBarNotification.java
+++ b/core/java/android/service/notification/StatusBarNotification.java
@@ -26,35 +26,21 @@
* the status bar and any {@link android.service.notification.NotificationListenerService}s.
*/
public class StatusBarNotification implements Parcelable {
- /** The package of the app that posted the notification. */
- public final String pkg;
- /** The id supplied to {@link android.app.NotificationManager#notify}. */
- public final int id;
- /** The tag supplied to {@link android.app.NotificationManager#notify}, or null if no tag
- * was specified. */
- public final String tag;
+ private final String pkg;
+ private final int id;
+ private final String tag;
- /** The notifying app's calling uid. @hide */
- public final int uid;
- /** The notifying app's base package. @hide */
- public final String basePkg;
- /** @hide */
- public final int initialPid;
+ private final int uid;
+ private final String basePkg;
+ private final int initialPid;
// TODO: make this field private and move callers to an accessor that
// ensures sourceUser is applied.
- /** The {@link android.app.Notification} supplied to
- * {@link android.app.NotificationManager#notify}. */
- public final Notification notification;
- /** The {@link android.os.UserHandle} for whom this notification is intended. */
- public final UserHandle user;
- /** The time (in {@link System#currentTimeMillis} time) the notification was posted,
- * which may be different than {@link android.app.Notification#when}.
- */
- public final long postTime;
+ private final Notification notification;
+ private final UserHandle user;
+ private final long postTime;
- /** @hide */
- public final int score;
+ private final int score;
/** This is temporarily needed for the JB MR1 PDK.
* @hide */
@@ -198,4 +184,61 @@
public int getUserId() {
return this.user.getIdentifier();
}
+
+ /** The package of the app that posted the notification. */
+ public String getPackageName() {
+ return pkg;
+ }
+
+ /** The id supplied to {@link android.app.NotificationManager#notify}. */
+ public int getId() {
+ return id;
+ }
+
+ /** The tag supplied to {@link android.app.NotificationManager#notify}, or null if no tag
+ * was specified. */
+ public String getTag() {
+ return tag;
+ }
+
+ /** The notifying app's calling uid. @hide */
+ public int getUid() {
+ return uid;
+ }
+
+ /** The notifying app's base package. @hide */
+ public String getBasePkg() {
+ return basePkg;
+ }
+
+ /** @hide */
+ public int getInitialPid() {
+ return initialPid;
+ }
+
+ /** The {@link android.app.Notification} supplied to
+ * {@link android.app.NotificationManager#notify}. */
+ public Notification getNotification() {
+ return notification;
+ }
+
+ /**
+ * The {@link android.os.UserHandle} for whom this notification is intended.
+ * @hide
+ */
+ public UserHandle getUser() {
+ return user;
+ }
+
+ /** The time (in {@link System#currentTimeMillis} time) the notification was posted,
+ * which may be different than {@link android.app.Notification#when}.
+ */
+ public long getPostTime() {
+ return postTime;
+ }
+
+ /** @hide */
+ public int getScore() {
+ return score;
+ }
}
diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java
index 2595ee5f..2a761c1 100644
--- a/core/java/android/view/InputDevice.java
+++ b/core/java/android/view/InputDevice.java
@@ -533,7 +533,6 @@
*
* @see MotionEvent#AXIS_X
* @see MotionEvent#AXIS_Y
- * @see #getSupportedAxes()
*/
public MotionRange getMotionRange(int axis) {
final int numRanges = mMotionRanges.size();
@@ -559,7 +558,6 @@
*
* @see MotionEvent#AXIS_X
* @see MotionEvent#AXIS_Y
- * @see #getSupportedAxes()
*/
public MotionRange getMotionRange(int axis, int source) {
final int numRanges = mMotionRanges.size();
diff --git a/core/java/android/view/InputEvent.java b/core/java/android/view/InputEvent.java
index 24c3128..07a937c 100644
--- a/core/java/android/view/InputEvent.java
+++ b/core/java/android/view/InputEvent.java
@@ -70,7 +70,6 @@
* Gets the source of the event.
*
* @return The event source or {@link InputDevice#SOURCE_UNKNOWN} if unknown.
- * @see InputDevice#getSourceInfo
*/
public abstract int getSource();
diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java
index 7d9f30a..0546d24 100644
--- a/core/java/android/view/KeyEvent.java
+++ b/core/java/android/view/KeyEvent.java
@@ -2822,7 +2822,7 @@
*
* @param symbolicName The symbolic name of the keycode.
* @return The keycode or {@link #KEYCODE_UNKNOWN} if not found.
- * @see #keycodeToString
+ * @see #keycodeToString(int)
*/
public static int keyCodeFromString(String symbolicName) {
if (symbolicName == null) {
diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java
index 78fa2d7..ee36097 100644
--- a/core/java/android/view/MotionEvent.java
+++ b/core/java/android/view/MotionEvent.java
@@ -1947,8 +1947,6 @@
* @see #TOOL_TYPE_FINGER
* @see #TOOL_TYPE_STYLUS
* @see #TOOL_TYPE_MOUSE
- * @see #TOOL_TYPE_INDIRECT_FINGER
- * @see #TOOL_TYPE_INDIRECT_STYLUS
*/
public final int getToolType(int pointerIndex) {
return nativeGetToolType(mNativePtr, pointerIndex);
@@ -2190,7 +2188,7 @@
* on the screen, before it had been adjusted for the containing window
* and views.
*
- * @see getX()
+ * @see #getX(int)
* @see #AXIS_X
*/
public final float getRawX() {
@@ -2203,7 +2201,7 @@
* on the screen, before it had been adjusted for the containing window
* and views.
*
- * @see getY()
+ * @see #getY(int)
* @see #AXIS_Y
*/
public final float getRawY() {
@@ -3063,7 +3061,7 @@
*
* @param symbolicName The symbolic name of the axis.
* @return The axis or -1 if not found.
- * @see #keycodeToString
+ * @see KeyEvent#keycodeToString(int)
*/
public static int axisFromString(String symbolicName) {
if (symbolicName == null) {
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index b5aa18f..5d82d79 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -6617,12 +6617,7 @@
* @hide
*/
public void clearAccessibilityFocus() {
- if ((mPrivateFlags2 & PFLAG2_ACCESSIBILITY_FOCUSED) != 0) {
- mPrivateFlags2 &= ~PFLAG2_ACCESSIBILITY_FOCUSED;
- invalidate();
- sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED);
- notifyAccessibilityStateChanged();
- }
+ clearAccessibilityFocusNoCallbacks();
// Clear the global reference of accessibility focus if this
// view or any of its descendants had accessibility focus.
ViewRootImpl viewRootImpl = getViewRootImpl();
@@ -6669,6 +6664,8 @@
if ((mPrivateFlags2 & PFLAG2_ACCESSIBILITY_FOCUSED) != 0) {
mPrivateFlags2 &= ~PFLAG2_ACCESSIBILITY_FOCUSED;
invalidate();
+ sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED);
+ notifyAccessibilityStateChanged();
}
}
@@ -8696,7 +8693,12 @@
/**
* Change the view's z order in the tree, so it's on top of other sibling
- * views
+ * views. This ordering change may affect layout, if the parent container
+ * uses an order-dependent layout scheme (e.g., LinearLayout). This
+ * method should be followed by calls to {@link #requestLayout()} and
+ * {@link View#invalidate()} on the parent.
+ *
+ * @see ViewGroup#bringChildToFront(View)
*/
public void bringToFront() {
if (mParent != null) {
diff --git a/core/java/android/view/ViewParent.java b/core/java/android/view/ViewParent.java
index 4b70bc0..d79aa7e 100644
--- a/core/java/android/view/ViewParent.java
+++ b/core/java/android/view/ViewParent.java
@@ -146,9 +146,13 @@
public View focusSearch(View v, int direction);
/**
- * Change the z order of the child so it's on top of all other children
+ * Change the z order of the child so it's on top of all other children.
+ * This ordering change may affect layout, if this container
+ * uses an order-dependent layout scheme (e.g., LinearLayout). This
+ * method should be followed by calls to {@link #requestLayout()} and
+ * {@link View#invalidate()} on this parent.
*
- * @param child
+ * @param child The child to bring to the top of the z order
*/
public void bringChildToFront(View child);
diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java
index c111a52..ce886f2 100644
--- a/core/java/android/webkit/BrowserFrame.java
+++ b/core/java/android/webkit/BrowserFrame.java
@@ -757,13 +757,16 @@
return null;
}
} else if (url.startsWith(ANDROID_ASSET)) {
- url = url.replaceFirst(ANDROID_ASSET, "");
+ String assetUrl = url.replaceFirst(ANDROID_ASSET, "");
try {
AssetManager assets = mContext.getAssets();
- Uri uri = Uri.parse(url);
+ Uri uri = Uri.parse(assetUrl);
return assets.open(uri.getPath(), AssetManager.ACCESS_STREAMING);
} catch (IOException e) {
return null;
+ } catch (Exception e) {
+ Log.w(LOGTAG, "Problem loading url: " + url, e);
+ return null;
}
} else if (mSettings.getAllowContentAccess() &&
url.startsWith(ANDROID_CONTENT)) {
diff --git a/core/jni/android_net_LocalSocketImpl.cpp b/core/jni/android_net_LocalSocketImpl.cpp
index 1426b2c..f2b69c6 100644
--- a/core/jni/android_net_LocalSocketImpl.cpp
+++ b/core/jni/android_net_LocalSocketImpl.cpp
@@ -371,7 +371,31 @@
return;
}
}
+static jint socket_pending (JNIEnv *env, jobject object,
+ jobject fileDescriptor)
+{
+ int fd;
+ fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
+
+ if (env->ExceptionOccurred() != NULL) {
+ return (jint)-1;
+ }
+
+ int pending;
+ int ret = ioctl(fd, TIOCOUTQ, &pending);
+
+ // If this were a non-socket fd, there would be other cases to worry
+ // about...
+
+ //ALOGD("socket_pending, ioctl ret:%d, pending:%d", ret, pending);
+ if (ret < 0) {
+ jniThrowIOException(env, errno);
+ return (jint) 0;
+ }
+
+ return (jint)pending;
+}
static jint socket_available (JNIEnv *env, jobject object,
jobject fileDescriptor)
{
@@ -893,6 +917,7 @@
{"accept", "(Ljava/io/FileDescriptor;Landroid/net/LocalSocketImpl;)Ljava/io/FileDescriptor;", (void*)socket_accept},
{"shutdown", "(Ljava/io/FileDescriptor;Z)V", (void*)socket_shutdown},
{"available_native", "(Ljava/io/FileDescriptor;)I", (void*) socket_available},
+ {"pending_native", "(Ljava/io/FileDescriptor;)I", (void*) socket_pending},
{"close_native", "(Ljava/io/FileDescriptor;)V", (void*) socket_close},
{"read_native", "(Ljava/io/FileDescriptor;)I", (void*) socket_read},
{"readba_native", "([BIILjava/io/FileDescriptor;)I", (void*) socket_readba},
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index cb14374..d2895b7 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -938,6 +938,15 @@
android:label="@string/permlab_camera"
android:description="@string/permdesc_camera" />
+ <!-- Allows disabling the transmit-indicator LED that is normally on when
+ a camera is in use by an application.
+ @hide -->
+ <permission android:name="android.permission.CAMERA_DISABLE_TRANSMIT_LED"
+ android:permissionGroup="android.permission-group.CAMERA"
+ android:protectionLevel="signature|system"
+ android:label="@string/permlab_cameraDisableTransmitLed"
+ android:description="@string/permdesc_cameraDisableTransmitLed" />
+
<!-- =========================================== -->
<!-- Permissions associated with telephony state -->
<!-- =========================================== -->
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index db9602a..a1479af 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1377,6 +1377,10 @@
<string name="permdesc_camera">Allows the app to take pictures and videos
with the camera. This permission allows the app to use the camera at any
time without your confirmation.</string>
+ <!-- Title of a camera app permission, listed so the user can choose whether or not they want to allow it to disable the may-transmit light indicator. -->
+ <string name="permlab_cameraDisableTransmitLed">disable transmit indicator LED when camera is in use</string>
+ <!-- Description of a camera app permission, listed so the user can choose whether or not they want to allow it to disable the may-transmit light indicator. -->
+ <string name="permdesc_cameraDisableTransmitLed">Allows a pre-installed system application to disable the camera use indicator LED.</string>
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_brick" product="tablet">permanently disable tablet</string>
@@ -4101,7 +4105,7 @@
<!-- Error message title [CHAR LIMIT=35] -->
<string name="error_message_title">Error</string>
<!-- Message informing user that app is not permitted to access accounts. [CHAR LIMIT=none] -->
- <string name="app_no_restricted_accounts">This application does not support accounts for limited users</string>
+ <string name="app_no_restricted_accounts">This application does not support accounts for restricted profiles</string>
<!-- Message informing user that the requested activity could not be found [CHAR LIMIT=none] -->
<string name="app_not_found">No application found to handle this action</string>
<string name="revoke">Revoke</string>
diff --git a/docs/html/distribute/googleplay/quality/tablet.jd b/docs/html/distribute/googleplay/quality/tablet.jd
index a54348b..192aae9 100644
--- a/docs/html/distribute/googleplay/quality/tablet.jd
+++ b/docs/html/distribute/googleplay/quality/tablet.jd
@@ -16,7 +16,7 @@
<li><a href="#hardware-requirements">9. Declare dependencies properly</a></li>
<li><a href="#support-screens">10. Declare tablet screens support</a></li>
<li><a href="#google-play">11. Showcase your tablet UI</a></li>
-<li><a href="#google-play-bp">12. Follow publishing best practices</a></li>
+<li><a href="#google-play-best-practices">12. Follow publishing best practices</a></li>
</ol>
<h2>Testing</h2>
@@ -68,8 +68,10 @@
<li><a href="#google-play">Screenshots are uploaded to Google Play</a></li>
</ul>
-<p>The sections that follow provide more information about these and other
-quality guidelines for tablet apps.</p>
+<p>If your app is already uploaded to the Google Play Developer Console, you
+ can see how it is doing against these checks
+ by visiting the <a href="#google-play-optimization-tips">Optimization
+ Tips page</a>.</p>
<h2 id="optimize-layouts">2. Optimize your layouts for larger screens</h2>
@@ -312,7 +314,15 @@
gets loaded.</li>
</ul>
-<p>At a minimum, your app should supply custom drawables and assets for common tablet screen densities, tagged with the qualifiers <code>hdpi</code>, <code>xhdpi</code>, or <code>xxhdpi</code>.</p>
+<p style="margin-bottom:.5em;">At a minimum, your app should supply sets of
+ custom drawables and assets for common tablet screen densities,
+ tagged with these qualifiers as appropriate:</p>
+
+<ul>
+ <li><code>hdpi</code>, OR</li>
+ <li><code>xhdpi</code>, OR</li>
+ <li><code>xxhdpi</code></li>
+</ul>
<div class="rel-resources">
<h3>
@@ -482,62 +492,103 @@
<h2 id="android-versions">8. Target Android versions properly</h2>
<p>To ensure the broadest possible distribution to tablets, make sure that your
-app is targeting the Android versions that support tablets. You can declare
-the targeted range of Android versions in the
-<a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html"><code><uses-sdk></code></a>
-element in the app manifest.</p>
+app properly targets the Android versions that support tablets. Initial support for
+tablets was added in <a href="{@docRoot}about/versions/android-3.0">Android 3.0</a> (API level 11). Unified UI
+framework support for tablets, phones, and other devices was introduced in <a href="{@docRoot}about/versions/android-4.0">Android 4.0</a> (API level 14) and is supported in later versions.
-<p>At a minimum, your app's
-<a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html"><code><uses-sdk></code></a>
-should declare support for Android versions as follows:</p>
+<p>You can set the app's
+range of targeted Android versions in the manifest file, in the
+<a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html"><code><uses-sdk></code></a> element. In most cases, you can target Android versions properly by setting the element's <code>targetSdkVersion</code> attribute to the highest API level available.</p>
- <ul>
- <li>If a <code>targetSdkVersion</code> attribute is declared, it should have a value of 11 or higher, OR</li>
- <li>If a <code>minSdkVersion</code> attribute is declared, it should have a value of 11 or higher.</li>
- <li>Also, if a <code>maxSdkVersion</code> attribute is declared, it must have a value of 12 or higher. Note that, in most cases, the use of <code>maxSdkVersion</code> is <em>not recommended</em>.</li>
+<p style="margin-bottom:.5em;">At a minimum, check the <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html"><code><uses-sdk></code></a>
+ element to make sure that:</p>
+
+ <ol style="list-style-type:lower-alpha;margin-top:0em;">
+ <li><code>targetSdkVersion</code> is declared with value 11 or higher (14 or higher is recommended), OR</li>
+ <li><code>minSdkVersion</code> is declared with value 11 or higher.</li>
+ <li>If a <code>maxSdkVersion</code> attribute is declared, it must have a value of 11 or higher. Note that, in general, the use of <code>maxSdkVersion</code> is <em>not recommended</em>.</li>
+</ol>
+
+<div class="rel-resources">
+<h3>
+ Related resources
+</h3>
+
+<ul>
+ <li>
+ <a href=
+ "{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels">Android API
+ Levels</a>—Introduces API levels and how they relate to compatibility.
+ A reference of available API levels is included.
+ </li>
+ <li>
+ <a href="{@docRoot}training/basics/supporting-devices/platforms.html">Supporting Different Platform Versions</a>—Training class showing how to declare support for
+ minimum and target API levels in your app.
+ </li>
</ul>
+</div>
<h2 id="hardware-requirements">9. Declare hardware feature dependencies properly</h2>
-<p>Handsets and tablets typically offer slightly different hardware support for
-sensors, camera, telephony, and other features. For example, many tablets are
-available in a "Wi-Fi" configuration that does not include telephony support.</p>
+<p>
+ Handsets and tablets typically offer slightly different hardware support for
+ sensors, camera, telephony, and other features. For example, many tablets are
+ available in a "Wi-Fi" configuration that does not include telephony support.
+</p>
-<p>To ensure that you can deliver a single APK broadly across the
-your full customer base, make sure that your app does not have built-in
-requirements for hardware features that aren't commonly available on tablets.
+<p>
+ So that you can distribute a single APK broadly across your full customer
+ base of phones and tablets, make sure that your app doesn't declare
+ requirements for hardware features that aren't commonly available on tablets.
+ Instead, properly declare the hardware features as <em>not required</em> in the app
+ manifest, as described below.
</p>
<ul>
-<li>Your app's manifest should not include <a
-href="{@docRoot}guide/topics/manifest/uses-feature-element.html"><code><uses-feature></code></a>
-elements for hardware features or capabilities that might not be
-available on tablets, except when they are declared with the
-<code>android:required=”false”</code> attribute. For example, your app should
-not <em>require</em> features such as:
+<li>In your app manifest, locate any <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html"><code><uses-feature></code></a>
+elements. In particular, look for hardware features that might not be
+available on some tablets, such as:
+
<ul>
<li><code>android.hardware.telephony</code></li>
<li><code>android.hardware.camera</code> (refers to back camera), or</li>
<li><code>android.hardware.camera.front</code></li>
-</ul>
-</li>
-<li>Similarly, your app manifest should not include any <a
-href="{@docRoot}guide/topics/manifest/permission-element.html"><code><permission></code></a> elements that <a
-href="{@docRoot}guide/topics/manifest/uses-feature-element.html#permissions">imply
-feature requirements</a> that might not be appropriate for tablets, except when
-accompanied by a corresponding <code><uses-feature></code> element
-declared with the <code>android:required=”false”</code> attribute.
-<p>Here's an example of a dependency that's properly declared as "not required", so that
-it does not limit distribution to devices that do not support the dependency:</p>
-<p><code><uses-feature android:name="android.hardware.telephony"
-android:required="false" /></code></p></li>
+</ul></li>
+
+<li>Declare the <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html"><code><uses-feature></code></a>
+elements as <em>not required</em> by including the <code>android:required=”false”</code>
+attribute.
+
+<p>
+ For example, here's the proper way to declare a dependency on
+ <code>android.hardware.telephony</code>, such that you can still
+ distribute the app broadly, even to devices that don't offer telephony:
+</p>
+
+<pre><uses-feature android:name="android.hardware.telephony" android:required="false" /></pre></li>
+
+<li>Similarly, check the manifest for <a href="/guide/topics/manifest/permission-element.html"><code><permission></code></a> elements that
+<a href="/guide/topics/manifest/uses-feature-element.html#permissions">imply hardware
+feature requirements</a> that not be appropriate for tablets. If you find such
+permissions, make sure to explicitly declare a corresponding
+<code><uses-feature></code> element for the features and includes the
+<code>android:required=”false”</code> attribute.</li>
</ul>
-<p>In all cases, the app must function normally when the hardware features it
-uses are not available and should offer "graceful degradation" and alternative
-functionality where appropriate. For example, if GPS is not supported on the device,
-your app could let the user set their location manually. The app should do
-run-time checking for the hardware capability that it needs and handle as needed.</p>
+
+<p>
+ After declaring hardware features as <em>not required</em>, make sure to test
+ your app on a variety of devices. The app should function normally when the
+ hardware features it uses are not available, and it should offer "graceful
+ degradation" and alternative functionality where appropriate.
+</p>
+
+<p>
+ For example, if an app normally uses GPS to set the location but GPS is not
+ supported on the device, the app could let the user set the location manually
+ instead. The app can check for device hardware capabilities at runtime and handle
+ as needed.
+</p>
<div class="rel-resources">
<h3>
@@ -570,9 +621,7 @@
<h2 id="support-screens">10. Declare support for tablet screens</h2>
<p>To ensure that you can distribute your app to a broad range of tablets, your app should
-declare support for tablet screen sizes in the
-<a href="{@docRoot}guide/topics/manifest/supports-screens-element.html"><code><supports-screens></code></a>
-element in the app manifest, as follows:</p>
+declare support for tablet screen sizes in its manifest file, as follows:</p>
<ul>
<li>A
@@ -590,7 +639,7 @@
element in the manifest, the element should include attributes that specify
<em>all of the size and density combinations for tablet screens</em> that the
app supports. Note that, if possible, you should avoid using the
-<a href="{@docRoot}guide/topics/manifest/supports-screens-element.html"><code><supports-screens></code></a>
+<a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html"><code><compatible-screens></code></a>
element in your app.</p>
<div class="rel-resources">
@@ -617,14 +666,14 @@
ways to promote your tablet app to users on Google Play.
</p>
-<h5>
+<h4>
Upload screenshots of your tablet UI
-</h5>
+</h4>
<p>
Tablet users want to know what your app is like on a tablet device, not on a
phone. If you developed a tablet app, make sure to upload screenshots
- of your tablet UI to the Developer Console. Here are some guidelines:
+ of your tablet UI to the Google Play Developer Console. Here are some guidelines:
</p>
<ul style="margin-top:0;">
@@ -652,9 +701,9 @@
</li>
</ul>
-<h5>
+<h4>
Update your app description and release notes
-</h5>
+</h4>
<ul>
<li>In your app description, make sure to highlight that your app offers
@@ -667,9 +716,9 @@
</li>
</ul>
-<h5>
+<h4>
Update your promotional video
-</h5>
+</h4>
<p>
Many users view an app's promotional video to get an idea of what the app is
@@ -698,9 +747,9 @@
</li>
</ul>
-<h5>
+<h4>
Feature your tablet UI in your promotional campaigns
-</h5>
+</h4>
<p>
Make sure to let tablet users know about your tablet UI in your promotional
@@ -759,15 +808,59 @@
</ul>
</div>
-<h2 id="google-play-bp">12. Follow best practices for publishing in Google Play</h2>
+<h2 id="google-play-best-practices">12. Follow best practices for publishing in Google Play</h2>
-Here are some best practices to consider when publishing a tablet app on Google Play.</p>
+<p>Here are some best practices for delivering a successful tablet app on Google Play.</p>
-<h5>Check the app's filtering</h5>
+<h4 id="google-play-optimization-tips">Check out your app's Optimization Tips</h4>
+
+<p>The Google Play Developer Console now offers an Optimization Tips page that
+lets you quickly check how your app is doing against basic guidelines for tablet app
+distribution and quality. To visit the page, sign into the Developer Console,
+load the app from All Applications, and click Optimization Tips in
+the left navigation.</p>
+
+<div class="sidebox-wrapper">
+<div class="sidebox">
+<h2 style="line-height:1em;">How to Send Feedback</h2>
+
+<p>Please use the link below to send
+feedback or request a manual review of your Optimization Tips.</p>
+
+<p>Make sure to read the relevant sections of the Tablet App Quality
+Guidelines prior to sending feedback.</p>
+
+<p><strong><a href="https://support.google.com/googleplay/android-developer/contact/tabletf"
+target="_googleplay" style="white-space:nowrap">Tablet Optimization
+Tips Feedback Form »</a></strong></p>
+</div>
+</div>
+
+<p>The Developer Console creates your app's Optimization Tips page
+by running a series of checks to verify basic quality
+criteria. If it finds any issues, it alerts you to them as "To Do"
+items in the Optimization Tips page.</p>
+
+<p>If you've developed a tablet experience for your app, make sure
+to visit the Optimization Tips page to see how your app is doing
+against the basic checks. If there are any issues listed, we
+recommend addressing them in your app and uploading a new binary for
+distribution, if needed.</p>
+
+<p>If the Optimization Tips page lists "To Do" issues that you feel don't
+apply to your app or affect its quality on tablets, please notify us
+using the <a href="https://support.google.com/googleplay/android-developer/contact/tabletf"
+target="_googleplay" style="white-space:nowrap">Tablet Optimization
+Tips Feedback Form</a>. We
+will review your app and update your Optimization Tips page as
+appropriate.</p>
+
+
+<h4>Confirm the app's filtering</h4>
<p>After you've uploaded the app to the <a href="https://play.google.com/apps/publish/">Developer Console</a>, check the APK's Supported Devices list to make sure that the app is not filtered from tablet devices that you want to target.</p>
-<h5>Distribute as a single APK</h5>
+<h4>Distribute as a single APK</h4>
<p>
It's recommended that you publish your app as a single APK for all screen
diff --git a/packages/SystemUI/ic_sysbar_internal.psd b/packages/SystemUI/ic_sysbar_internal.psd
new file mode 100644
index 0000000..929c872
--- /dev/null
+++ b/packages/SystemUI/ic_sysbar_internal.psd
Binary files differ
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 5b911c1..683824b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -315,9 +315,9 @@
protected View updateNotificationVetoButton(View row, StatusBarNotification n) {
View vetoButton = row.findViewById(R.id.veto);
if (n.isClearable()) {
- final String _pkg = n.pkg;
- final String _tag = n.tag;
- final int _id = n.id;
+ final String _pkg = n.getPackageName();
+ final String _tag = n.getTag();
+ final int _id = n.getId();
vetoButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Accessibility feedback
@@ -341,14 +341,14 @@
protected void applyLegacyRowBackground(StatusBarNotification sbn, View content) {
- if (sbn.notification.contentView.getLayoutId() !=
+ if (sbn.getNotification().contentView.getLayoutId() !=
com.android.internal.R.layout.notification_template_base) {
int version = 0;
try {
- ApplicationInfo info = mContext.getPackageManager().getApplicationInfo(sbn.pkg, 0);
+ ApplicationInfo info = mContext.getPackageManager().getApplicationInfo(sbn.getPackageName(), 0);
version = info.targetSdkVersion;
} catch (NameNotFoundException ex) {
- Slog.e(TAG, "Failed looking up ApplicationInfo for " + sbn.pkg, ex);
+ Slog.e(TAG, "Failed looking up ApplicationInfo for " + sbn.getPackageName(), ex);
}
if (version > 0 && version < Build.VERSION_CODES.GINGERBREAD) {
content.setBackgroundResource(R.drawable.notification_row_legacy_bg);
@@ -729,8 +729,8 @@
int maxHeight =
mContext.getResources().getDimensionPixelSize(R.dimen.notification_max_height);
StatusBarNotification sbn = entry.notification;
- RemoteViews oneU = sbn.notification.contentView;
- RemoteViews large = sbn.notification.bigContentView;
+ RemoteViews oneU = sbn.getNotification().contentView;
+ RemoteViews large = sbn.getNotification().bigContentView;
if (oneU == null) {
return false;
}
@@ -741,7 +741,7 @@
View row = inflater.inflate(R.layout.status_bar_notification_row, parent, false);
// for blaming (see SwipeHelper.setLongPressListener)
- row.setTag(sbn.pkg);
+ row.setTag(sbn.getPackageName());
workAroundBadLayerDrawableOpacity(row);
View vetoButton = updateNotificationVetoButton(row, sbn);
@@ -756,10 +756,10 @@
content.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
- PendingIntent contentIntent = sbn.notification.contentIntent;
+ PendingIntent contentIntent = sbn.getNotification().contentIntent;
if (contentIntent != null) {
final View.OnClickListener listener = new NotificationClicker(contentIntent,
- sbn.pkg, sbn.tag, sbn.id);
+ sbn.getPackageName(), sbn.getTag(), sbn.getId());
content.setOnClickListener(listener);
} else {
content.setOnClickListener(null);
@@ -775,7 +775,7 @@
}
}
catch (RuntimeException e) {
- final String ident = sbn.pkg + "/0x" + Integer.toHexString(sbn.id);
+ final String ident = sbn.getPackageName() + "/0x" + Integer.toHexString(sbn.getId());
Slog.e(TAG, "couldn't inflate view for notification " + ident, e);
return false;
}
@@ -904,7 +904,7 @@
void handleNotificationError(IBinder key, StatusBarNotification n, String message) {
removeNotification(key);
try {
- mBarService.onNotificationError(n.pkg, n.tag, n.id, n.uid, n.initialPid, message);
+ mBarService.onNotificationError(n.getPackageName(), n.getTag(), n.getId(), n.getUid(), n.getInitialPid(), message);
} catch (RemoteException ex) {
// The end is nigh.
}
@@ -932,16 +932,16 @@
}
// Construct the icon.
final StatusBarIconView iconView = new StatusBarIconView(mContext,
- notification.pkg + "/0x" + Integer.toHexString(notification.id),
- notification.notification);
+ notification.getPackageName() + "/0x" + Integer.toHexString(notification.getId()),
+ notification.getNotification());
iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
- final StatusBarIcon ic = new StatusBarIcon(notification.pkg,
- notification.user,
- notification.notification.icon,
- notification.notification.iconLevel,
- notification.notification.number,
- notification.notification.tickerText);
+ final StatusBarIcon ic = new StatusBarIcon(notification.getPackageName(),
+ notification.getUser(),
+ notification.getNotification().icon,
+ notification.getNotification().iconLevel,
+ notification.getNotification().number,
+ notification.getNotification().tickerText);
if (!iconView.set(ic)) {
handleNotificationError(key, notification, "Couldn't create icon: " + ic);
return null;
@@ -1026,19 +1026,19 @@
final StatusBarNotification oldNotification = oldEntry.notification;
// XXX: modify when we do something more intelligent with the two content views
- final RemoteViews oldContentView = oldNotification.notification.contentView;
- final RemoteViews contentView = notification.notification.contentView;
- final RemoteViews oldBigContentView = oldNotification.notification.bigContentView;
- final RemoteViews bigContentView = notification.notification.bigContentView;
+ final RemoteViews oldContentView = oldNotification.getNotification().contentView;
+ final RemoteViews contentView = notification.getNotification().contentView;
+ final RemoteViews oldBigContentView = oldNotification.getNotification().bigContentView;
+ final RemoteViews bigContentView = notification.getNotification().bigContentView;
if (DEBUG) {
- Slog.d(TAG, "old notification: when=" + oldNotification.notification.when
+ Slog.d(TAG, "old notification: when=" + oldNotification.getNotification().when
+ " ongoing=" + oldNotification.isOngoing()
+ " expanded=" + oldEntry.expanded
+ " contentView=" + oldContentView
+ " bigContentView=" + oldBigContentView
+ " rowParent=" + oldEntry.row.getParent());
- Slog.d(TAG, "new notification: when=" + notification.notification.when
+ Slog.d(TAG, "new notification: when=" + notification.getNotification().when
+ " ongoing=" + oldNotification.isOngoing()
+ " contentView=" + contentView
+ " bigContentView=" + bigContentView);
@@ -1062,13 +1062,13 @@
&& oldBigContentView.getPackage().equals(bigContentView.getPackage())
&& oldBigContentView.getLayoutId() == bigContentView.getLayoutId());
ViewGroup rowParent = (ViewGroup) oldEntry.row.getParent();
- boolean orderUnchanged = notification.notification.when==oldNotification.notification.when
- && notification.score == oldNotification.score;
+ boolean orderUnchanged = notification.getNotification().when== oldNotification.getNotification().when
+ && notification.getScore() == oldNotification.getScore();
// score now encompasses/supersedes isOngoing()
- boolean updateTicker = notification.notification.tickerText != null
- && !TextUtils.equals(notification.notification.tickerText,
- oldEntry.notification.notification.tickerText);
+ boolean updateTicker = notification.getNotification().tickerText != null
+ && !TextUtils.equals(notification.getNotification().tickerText,
+ oldEntry.notification.getNotification().tickerText);
boolean isTopAnyway = isTopNotification(rowParent, oldEntry);
if (contentsUnchanged && bigContentsUnchanged && (orderUnchanged || isTopAnyway)) {
if (DEBUG) Slog.d(TAG, "reusing notification for key: " + key);
@@ -1080,20 +1080,20 @@
bigContentView.reapply(mContext, oldEntry.getLargeView(), mOnClickHandler);
}
// update the contentIntent
- final PendingIntent contentIntent = notification.notification.contentIntent;
+ final PendingIntent contentIntent = notification.getNotification().contentIntent;
if (contentIntent != null) {
final View.OnClickListener listener = makeClicker(contentIntent,
- notification.pkg, notification.tag, notification.id);
+ notification.getPackageName(), notification.getTag(), notification.getId());
oldEntry.content.setOnClickListener(listener);
} else {
oldEntry.content.setOnClickListener(null);
}
// Update the icon.
- final StatusBarIcon ic = new StatusBarIcon(notification.pkg,
- notification.user,
- notification.notification.icon, notification.notification.iconLevel,
- notification.notification.number,
- notification.notification.tickerText);
+ final StatusBarIcon ic = new StatusBarIcon(notification.getPackageName(),
+ notification.getUser(),
+ notification.getNotification().icon, notification.getNotification().iconLevel,
+ notification.getNotification().number,
+ notification.getNotification().tickerText);
if (!oldEntry.icon.set(ic)) {
handleNotificationError(key, notification, "Couldn't update icon: " + ic);
return;
@@ -1144,7 +1144,7 @@
if (DEBUG) Slog.d(TAG, "updating the current intruder:" + notification);
// XXX: this is a hack for Alarms. The real implementation will need to *update*
// the intruder.
- if (notification.notification.fullScreenIntent == null) { // TODO(dsandler): consistent logic with add()
+ if (notification.getNotification().fullScreenIntent == null) { // TODO(dsandler): consistent logic with add()
if (DEBUG) Slog.d(TAG, "no longer intrudes!");
mHandler.sendEmptyMessage(MSG_HIDE_INTRUDER);
}
@@ -1155,9 +1155,9 @@
// A: Almost none! Only things coming from the system (package is "android") that also
// have special "kind" tags marking them as relevant for setup (see below).
protected boolean showNotificationEvenIfUnprovisioned(StatusBarNotification sbn) {
- if ("android".equals(sbn.pkg)) {
- if (sbn.notification.kind != null) {
- for (String aKind : sbn.notification.kind) {
+ if ("android".equals(sbn.getPackageName())) {
+ if (sbn.getNotification().kind != null) {
+ for (String aKind : sbn.getNotification().kind) {
// IME switcher, created by InputMethodManagerService
if ("android.system.imeswitcher".equals(aKind)) return true;
// OTA availability & errors, created by SystemUpdateService
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
index 886ed77..2c7a2a8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
@@ -89,10 +89,10 @@
public int compare(Entry a, Entry b) {
final StatusBarNotification na = a.notification;
final StatusBarNotification nb = b.notification;
- int d = na.score - nb.score;
+ int d = na.getScore() - nb.getScore();
return (d != 0)
? d
- : (int)(na.notification.when - nb.notification.when);
+ : (int)(na.getNotification().when - nb.getNotification().when);
}
};
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 d98f08e..edb3172 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -863,7 +863,7 @@
}
public void addNotification(IBinder key, StatusBarNotification notification) {
- if (DEBUG) Slog.d(TAG, "addNotification score=" + notification.score);
+ if (DEBUG) Slog.d(TAG, "addNotification score=" + notification.getScore());
StatusBarIconView iconView = addNotificationViews(key, notification);
if (iconView == null) return;
@@ -912,7 +912,7 @@
} else
*/
- if (notification.notification.fullScreenIntent != null) {
+ if (notification.getNotification().fullScreenIntent != null) {
// Stop screensaver if the notification has a full-screen intent.
// (like an incoming phone call)
awakenDreams();
@@ -920,7 +920,7 @@
// not immersive & a full-screen alert should be shown
if (DEBUG) Slog.d(TAG, "Notification has fullScreenIntent; sending fullScreenIntent");
try {
- notification.notification.fullScreenIntent.send();
+ notification.getNotification().fullScreenIntent.send();
} catch (PendingIntent.CanceledException e) {
}
} else {
@@ -1053,7 +1053,7 @@
// If the device hasn't been through Setup, we only show system notifications
for (int i=0; i<N; i++) {
Entry ent = mNotificationData.get(N-i-1);
- if (!((provisioned && ent.notification.score >= HIDE_ICONS_BELOW_SCORE)
+ if (!((provisioned && ent.notification.getScore() >= HIDE_ICONS_BELOW_SCORE)
|| showNotificationEvenIfUnprovisioned(ent.notification))) continue;
if (!notificationIsForCurrentUser(ent.notification)) continue;
toShow.add(ent.icon);
@@ -1961,7 +1961,7 @@
// until status bar window is attached to the window manager,
// because... well, what's the point otherwise? And trying to
// run a ticker without being attached will crash!
- if (n.notification.tickerText != null && mStatusBarWindow.getWindowToken() != null) {
+ if (n.getNotification().tickerText != null && mStatusBarWindow.getWindowToken() != null) {
if (0 == (mDisabled & (StatusBarManager.DISABLE_NOTIFICATION_ICONS
| StatusBarManager.DISABLE_NOTIFICATION_TICKER))) {
mTicker.addEntry(n);
@@ -2066,9 +2066,9 @@
NotificationData.Entry e = mNotificationData.get(i);
pw.println(" [" + i + "] key=" + e.key + " icon=" + e.icon);
StatusBarNotification n = e.notification;
- pw.println(" pkg=" + n.pkg + " id=" + n.id + " score=" + n.score);
- pw.println(" notification=" + n.notification);
- pw.println(" tickerText=\"" + n.notification.tickerText + "\"");
+ pw.println(" pkg=" + n.getPackageName() + " id=" + n.getId() + " score=" + n.getScore());
+ pw.println(" notification=" + n.getNotification());
+ pw.println(" tickerText=\"" + n.getNotification().tickerText + "\"");
}
}
@@ -2369,9 +2369,9 @@
try {
mBarService.onNotificationClear(
- mCurrentlyIntrudingNotification.pkg,
- mCurrentlyIntrudingNotification.tag,
- mCurrentlyIntrudingNotification.id);
+ mCurrentlyIntrudingNotification.getPackageName(),
+ mCurrentlyIntrudingNotification.getTag(),
+ mCurrentlyIntrudingNotification.getId());
} catch (android.os.RemoteException ex) {
// oh well
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/Ticker.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/Ticker.java
index 976dd01..f3f6a80 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/Ticker.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/Ticker.java
@@ -189,25 +189,25 @@
// a notification storm).
if (initialCount > 0) {
final Segment seg = mSegments.get(0);
- if (n.pkg.equals(seg.notification.pkg)
- && n.notification.icon == seg.notification.notification.icon
- && n.notification.iconLevel == seg.notification.notification.iconLevel
- && CharSequences.equals(seg.notification.notification.tickerText,
- n.notification.tickerText)) {
+ if (n.getPackageName().equals(seg.notification.getPackageName())
+ && n.getNotification().icon == seg.notification.getNotification().icon
+ && n.getNotification().iconLevel == seg.notification.getNotification().iconLevel
+ && CharSequences.equals(seg.notification.getNotification().tickerText,
+ n.getNotification().tickerText)) {
return;
}
}
final Drawable icon = StatusBarIconView.getIcon(mContext,
- new StatusBarIcon(n.pkg, n.user, n.notification.icon, n.notification.iconLevel, 0,
- n.notification.tickerText));
- final CharSequence text = n.notification.tickerText;
+ new StatusBarIcon(n.getPackageName(), n.getUser(), n.getNotification().icon, n.getNotification().iconLevel, 0,
+ n.getNotification().tickerText));
+ final CharSequence text = n.getNotification().tickerText;
final Segment newSegment = new Segment(n, icon, text);
// If there's already a notification schedule for this package and id, remove it.
for (int i=0; i<mSegments.size(); i++) {
Segment seg = mSegments.get(i);
- if (n.id == seg.notification.id && n.pkg.equals(seg.notification.pkg)) {
+ if (n.getId() == seg.notification.getId() && n.getPackageName().equals(seg.notification.getPackageName())) {
// just update that one to use this new data instead
mSegments.remove(i--); // restart iteration here
}
@@ -235,7 +235,7 @@
public void removeEntry(StatusBarNotification n) {
for (int i=mSegments.size()-1; i>=0; i--) {
Segment seg = mSegments.get(i);
- if (n.id == seg.notification.id && n.pkg.equals(seg.notification.pkg)) {
+ if (n.getId() == seg.notification.getId() && n.getPackageName().equals(seg.notification.getPackageName())) {
mSegments.remove(i);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
index 05bba89..bfa1b63 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
@@ -859,12 +859,12 @@
final boolean immersive = isImmersive();
if (false && immersive) {
// TODO: immersive mode popups for tablet
- } else if (notification.notification.fullScreenIntent != null) {
+ } else if (notification.getNotification().fullScreenIntent != null) {
// not immersive & a full-screen alert should be shown
Slog.w(TAG, "Notification has fullScreenIntent and activity is not immersive;"
+ " sending fullScreenIntent");
try {
- notification.notification.fullScreenIntent.send();
+ notification.getNotification().fullScreenIntent.send();
} catch (PendingIntent.CanceledException e) {
}
} else {
@@ -971,14 +971,14 @@
}
// If they asked for FLAG_ONLY_ALERT_ONCE, then only show this notification
// if it's a new notification.
- if (!firstTime && (n.notification.flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0) {
+ if (!firstTime && (n.getNotification().flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0) {
return;
}
// Show the ticker if one is requested. Also don't do this
// until status bar window is attached to the window manager,
// because... well, what's the point otherwise? And trying to
// run a ticker without being attached will crash!
- if (hasTicker(n.notification) && mStatusBarView.getWindowToken() != null) {
+ if (hasTicker(n.getNotification()) && mStatusBarView.getWindowToken() != null) {
if (0 == (mDisabled & (StatusBarManager.DISABLE_NOTIFICATION_ICONS
| StatusBarManager.DISABLE_NOTIFICATION_TICKER))) {
mTicker.add(key, n);
@@ -1410,7 +1410,7 @@
for (int i=0; toShow.size()< maxNotificationIconsCount; i++) {
if (i >= N) break;
Entry ent = mNotificationData.get(N-i-1);
- if ((provisioned && ent.notification.score >= HIDE_ICONS_BELOW_SCORE)
+ if ((provisioned && ent.notification.getScore() >= HIDE_ICONS_BELOW_SCORE)
|| showNotificationEvenIfUnprovisioned(ent.notification)) {
toShow.add(ent.icon);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java
index 725d9e6..095c441 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java
@@ -249,7 +249,7 @@
}
private View makeTickerView(StatusBarNotification notification) {
- final Notification n = notification.notification;
+ final Notification n = notification.getNotification();
LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
@@ -274,8 +274,8 @@
exception = e;
}
if (expanded == null) {
- final String ident = notification.pkg
- + "/0x" + Integer.toHexString(notification.id);
+ final String ident = notification.getPackageName()
+ + "/0x" + Integer.toHexString(notification.getId());
Slog.e(TAG, "couldn't inflate view for notification " + ident, exception);
return null;
}
@@ -286,7 +286,7 @@
} else if (n.tickerText != null) {
group = (ViewGroup)inflater.inflate(R.layout.system_bar_ticker_compat, mWindow, false);
final Drawable icon = StatusBarIconView.getIcon(mContext,
- new StatusBarIcon(notification.pkg, notification.user, n.icon, n.iconLevel, 0,
+ new StatusBarIcon(notification.getPackageName(), notification.getUser(), n.icon, n.iconLevel, 0,
n.tickerText));
ImageView iv = (ImageView)group.findViewById(iconId);
iv.setImageDrawable(icon);
@@ -313,12 +313,12 @@
}
if (CLICKABLE_TICKER) {
- PendingIntent contentIntent = notification.notification.contentIntent;
+ PendingIntent contentIntent = notification.getNotification().contentIntent;
if (contentIntent != null) {
// create the usual notification clicker, but chain it together with a halt() call
// to abort the ticker too
final View.OnClickListener clicker = mBar.makeClicker(contentIntent,
- notification.pkg, notification.tag, notification.id);
+ notification.getPackageName(), notification.getTag(), notification.getId());
group.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
halt();
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java
index 1bcee4e..770fafc 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java
@@ -169,6 +169,7 @@
KeyguardWidgetFrame newWidgetPage = getWidgetPageAt(newPageIndex);
if (newWidgetPage != null) {
newWidgetPage.onActive(true);
+ newWidgetPage.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
newWidgetPage.requestAccessibilityFocus();
}
if (mParent != null && AccessibilityManager.getInstance(mContext).isEnabled()) {
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index ab38ed20..3d6b6e7 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -6110,15 +6110,42 @@
for (size_t i = 0; i < mAxes.size(); i++) {
const Axis& axis = mAxes.valueAt(i);
- info->addMotionRange(axis.axisInfo.axis, AINPUT_SOURCE_JOYSTICK,
- axis.min, axis.max, axis.flat, axis.fuzz, axis.resolution);
+ addMotionRange(axis.axisInfo.axis, axis, info);
+
if (axis.axisInfo.mode == AxisInfo::MODE_SPLIT) {
- info->addMotionRange(axis.axisInfo.highAxis, AINPUT_SOURCE_JOYSTICK,
- axis.min, axis.max, axis.flat, axis.fuzz, axis.resolution);
+ addMotionRange(axis.axisInfo.highAxis, axis, info);
+
}
}
}
+void JoystickInputMapper::addMotionRange(int32_t axisId, const Axis& axis,
+ InputDeviceInfo* info) {
+ info->addMotionRange(axisId, AINPUT_SOURCE_JOYSTICK,
+ axis.min, axis.max, axis.flat, axis.fuzz, axis.resolution);
+ /* In order to ease the transition for developers from using the old axes
+ * to the newer, more semantically correct axes, we'll continue to register
+ * the old axes as duplicates of their corresponding new ones. */
+ int32_t compatAxis = getCompatAxis(axisId);
+ if (compatAxis >= 0) {
+ info->addMotionRange(compatAxis, AINPUT_SOURCE_JOYSTICK,
+ axis.min, axis.max, axis.flat, axis.fuzz, axis.resolution);
+ }
+}
+
+/* A mapping from axes the joystick actually has to the axes that should be
+ * artificially created for compatibility purposes.
+ * Returns -1 if no compatibility axis is needed. */
+int32_t JoystickInputMapper::getCompatAxis(int32_t axis) {
+ switch(axis) {
+ case AMOTION_EVENT_AXIS_LTRIGGER:
+ return AMOTION_EVENT_AXIS_BRAKE;
+ case AMOTION_EVENT_AXIS_RTRIGGER:
+ return AMOTION_EVENT_AXIS_GAS;
+ }
+ return -1;
+}
+
void JoystickInputMapper::dump(String8& dump) {
dump.append(INDENT2 "Joystick Input Mapper:\n");
@@ -6373,9 +6400,10 @@
size_t numAxes = mAxes.size();
for (size_t i = 0; i < numAxes; i++) {
const Axis& axis = mAxes.valueAt(i);
- pointerCoords.setAxisValue(axis.axisInfo.axis, axis.currentValue);
+ setPointerCoordsAxisValue(&pointerCoords, axis.axisInfo.axis, axis.currentValue);
if (axis.axisInfo.mode == AxisInfo::MODE_SPLIT) {
- pointerCoords.setAxisValue(axis.axisInfo.highAxis, axis.highCurrentValue);
+ setPointerCoordsAxisValue(&pointerCoords, axis.axisInfo.highAxis,
+ axis.highCurrentValue);
}
}
@@ -6391,6 +6419,19 @@
getListener()->notifyMotion(&args);
}
+void JoystickInputMapper::setPointerCoordsAxisValue(PointerCoords* pointerCoords,
+ int32_t axis, float value) {
+ pointerCoords->setAxisValue(axis, value);
+ /* In order to ease the transition for developers from using the old axes
+ * to the newer, more semantically correct axes, we'll continue to produce
+ * values for the old axes as mirrors of the value of their corresponding
+ * new axes. */
+ int32_t compatAxis = getCompatAxis(axis);
+ if (compatAxis >= 0) {
+ pointerCoords->setAxisValue(compatAxis, value);
+ }
+}
+
bool JoystickInputMapper::filterAxes(bool force) {
bool atLeastOneSignificantChange = force;
size_t numAxes = mAxes.size();
diff --git a/services/input/InputReader.h b/services/input/InputReader.h
index 312f19b..ed2a5c1 100644
--- a/services/input/InputReader.h
+++ b/services/input/InputReader.h
@@ -1805,6 +1805,11 @@
float newValue, float currentValue, float thresholdValue);
static bool isCenteredAxis(int32_t axis);
+ static int32_t getCompatAxis(int32_t axis);
+
+ static void addMotionRange(int32_t axisId, const Axis& axis, InputDeviceInfo* info);
+ static void setPointerCoordsAxisValue(PointerCoords* pointerCoords, int32_t axis,
+ float value);
};
} // namespace android
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
index f0257ffe..cc74b92 100644
--- a/services/java/com/android/server/NotificationManagerService.java
+++ b/services/java/com/android/server/NotificationManagerService.java
@@ -49,7 +49,6 @@
import android.media.IRingtonePlayer;
import android.net.Uri;
import android.os.Binder;
-import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
@@ -285,7 +284,7 @@
public void record(StatusBarNotification nr) {
// Nuke heavy parts of notification before storing in archive
- nr.notification.lightenPayload();
+ nr.getNotification().lightenPayload();
if (mBuffer.size() == BUFFER_SIZE) {
mBuffer.removeFirst();
@@ -312,7 +311,7 @@
private StatusBarNotification findNext() {
while (iter.hasNext()) {
StatusBarNotification nr = iter.next();
- if ((pkg == null || nr.pkg == pkg)
+ if ((pkg == null || nr.getPackageName() == pkg)
&& (userId == UserHandle.USER_ALL || nr.getUserId() == userId)) {
return nr;
}
@@ -786,7 +785,7 @@
*
* @param token The binder for the listener, to check that the caller is allowed
*/
- public void clearAllNotificationsFromListener(INotificationListener token) {
+ public void cancelAllNotificationsFromListener(INotificationListener token) {
NotificationListenerInfo info = checkListenerToken(token);
long identity = Binder.clearCallingIdentity();
try {
@@ -803,7 +802,7 @@
*
* @param token The binder for the listener, to check that the caller is allowed
*/
- public void clearNotificationFromListener(INotificationListener token, String pkg, String tag, int id) {
+ public void cancelNotificationFromListener(INotificationListener token, String pkg, String tag, int id) {
NotificationListenerInfo info = checkListenerToken(token);
long identity = Binder.clearCallingIdentity();
try {
@@ -816,6 +815,30 @@
}
}
+ /**
+ * Allow an INotificationListener to request the list of outstanding notifications seen by
+ * the current user. Useful when starting up, after which point the listener callbacks should
+ * be used.
+ *
+ * @param token The binder for the listener, to check that the caller is allowed
+ */
+ public StatusBarNotification[] getActiveNotificationsFromListener(INotificationListener token) {
+ NotificationListenerInfo info = checkListenerToken(token);
+
+ StatusBarNotification[] result = new StatusBarNotification[0];
+ ArrayList<StatusBarNotification> list = new ArrayList<StatusBarNotification>();
+ synchronized (mNotificationList) {
+ final int N = mNotificationList.size();
+ for (int i=0; i<N; i++) {
+ StatusBarNotification sbn = mNotificationList.get(i).sbn;
+ if (info.enabledAndUserMatches(sbn)) {
+ list.add(sbn);
+ }
+ }
+ }
+ return list.toArray(result);
+ }
+
// -- end of listener APIs --
public static final class NotificationRecord
@@ -828,17 +851,17 @@
this.sbn = sbn;
}
- public Notification getNotification() { return sbn.notification; }
- public int getFlags() { return sbn.notification.flags; }
+ public Notification getNotification() { return sbn.getNotification(); }
+ public int getFlags() { return sbn.getNotification().flags; }
public int getUserId() { return sbn.getUserId(); }
void dump(PrintWriter pw, String prefix, Context baseContext) {
- final Notification notification = sbn.notification;
+ final Notification notification = sbn.getNotification();
pw.println(prefix + this);
- pw.println(prefix + " uid=" + sbn.uid + " userId=" + sbn.getUserId());
+ pw.println(prefix + " uid=" + sbn.getUid() + " userId=" + sbn.getUserId());
pw.println(prefix + " icon=0x" + Integer.toHexString(notification.icon)
- + " / " + idDebugString(baseContext, sbn.pkg, notification.icon));
- pw.println(prefix + " pri=" + notification.priority + " score=" + sbn.score);
+ + " / " + idDebugString(baseContext, sbn.getPackageName(), notification.icon));
+ pw.println(prefix + " pri=" + notification.priority + " score=" + sbn.getScore());
pw.println(prefix + " contentIntent=" + notification.contentIntent);
pw.println(prefix + " deleteIntent=" + notification.deleteIntent);
pw.println(prefix + " tickerText=" + notification.tickerText);
@@ -897,8 +920,8 @@
return String.format(
"NotificationRecord(0x%08x: pkg=%s user=%s id=%d tag=%s score=%d: %s)",
System.identityHashCode(this),
- this.sbn.pkg, this.sbn.user, this.sbn.id, this.sbn.tag,
- this.sbn.score, this.sbn.notification);
+ this.sbn.getPackageName(), this.sbn.getUser(), this.sbn.getId(), this.sbn.getTag(),
+ this.sbn.getScore(), this.sbn.getNotification());
}
}
@@ -1517,7 +1540,7 @@
final int N = mNotificationList.size();
for (int i=0; i<N; i++) {
final NotificationRecord r = mNotificationList.get(i);
- if (r.sbn.pkg.equals(pkg) && r.sbn.getUserId() == userId) {
+ if (r.sbn.getPackageName().equals(pkg) && r.sbn.getUserId() == userId) {
count++;
if (count >= MAX_PACKAGE_NOTIFICATIONS) {
Slog.e(TAG, "Package has already posted " + count
@@ -1634,7 +1657,7 @@
long identity = Binder.clearCallingIdentity();
try {
r.statusBarKey = mStatusBar.addNotification(n);
- if ((n.notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0
+ if ((n.getNotification().flags & Notification.FLAG_SHOW_LIGHTS) != 0
&& canInterrupt) {
mAttentionLight.pulse();
}
@@ -1750,7 +1773,7 @@
// does not have the VIBRATE permission.
long identity = Binder.clearCallingIdentity();
try {
- mVibrator.vibrate(r.sbn.uid, r.sbn.basePkg,
+ mVibrator.vibrate(r.sbn.getUid(), r.sbn.getBasePkg(),
useDefaultVibrate ? mDefaultVibrationPattern
: mFallbackVibrationPattern,
((notification.flags & Notification.FLAG_INSISTENT) != 0) ? 0: -1);
@@ -1759,7 +1782,7 @@
}
} else if (notification.vibrate.length > 1) {
// If you want your own vibration pattern, you need the VIBRATE permission
- mVibrator.vibrate(r.sbn.uid, r.sbn.basePkg, notification.vibrate,
+ mVibrator.vibrate(r.sbn.getUid(), r.sbn.getBasePkg(), notification.vibrate,
((notification.flags & Notification.FLAG_INSISTENT) != 0) ? 0: -1);
}
}
@@ -1816,7 +1839,7 @@
} catch (PendingIntent.CanceledException ex) {
// do nothing - there's no relevant way to recover, and
// no reason to let this propagate
- Slog.w(TAG, "canceled PendingIntent for " + r.sbn.pkg, ex);
+ Slog.w(TAG, "canceled PendingIntent for " + r.sbn.getPackageName(), ex);
}
}
}
@@ -1941,7 +1964,7 @@
if ((r.getFlags() & mustNotHaveFlags) != 0) {
continue;
}
- if (pkg != null && !r.sbn.pkg.equals(pkg)) {
+ if (pkg != null && !r.sbn.getPackageName().equals(pkg)) {
continue;
}
canceledSomething = true;
@@ -2041,7 +2064,7 @@
if (mLedNotification == null || mInCall || mScreenOn) {
mNotificationLight.turnOff();
} else {
- final Notification ledno = mLedNotification.sbn.notification;
+ final Notification ledno = mLedNotification.sbn.getNotification();
int ledARGB = ledno.ledARGB;
int ledOnMS = ledno.ledOnMS;
int ledOffMS = ledno.ledOffMS;
@@ -2065,19 +2088,19 @@
final int len = list.size();
for (int i=0; i<len; i++) {
NotificationRecord r = list.get(i);
- if (!notificationMatchesUserId(r, userId) || r.sbn.id != id) {
+ if (!notificationMatchesUserId(r, userId) || r.sbn.getId() != id) {
continue;
}
if (tag == null) {
- if (r.sbn.tag != null) {
+ if (r.sbn.getTag() != null) {
continue;
}
} else {
- if (!tag.equals(r.sbn.tag)) {
+ if (!tag.equals(r.sbn.getTag())) {
continue;
}
}
- if (r.sbn.pkg.equals(pkg)) {
+ if (r.sbn.getPackageName().equals(pkg)) {
return i;
}
}
diff --git a/services/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
index 64dfd67..3fd534e 100644
--- a/services/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -1261,6 +1261,7 @@
}
private void onUserStateChangedLocked(UserState userState) {
+ updateLegacyCapabilities(userState);
updateServicesLocked(userState);
updateTouchExplorationLocked(userState);
updateEnhancedWebAccessibilityLocked(userState);
@@ -1268,6 +1269,28 @@
scheduleUpdateClientsIfNeededLocked(userState);
}
+ private void updateLegacyCapabilities(UserState userState) {
+ // Up to JB-MR1 we had a white list with services that can enable touch
+ // exploration. When a service is first started we show a dialog to the
+ // use to get a permission to white list the service.
+ final int installedServiceCount = userState.mInstalledServices.size();
+ for (int i = 0; i < installedServiceCount; i++) {
+ AccessibilityServiceInfo serviceInfo = userState.mInstalledServices.get(i);
+ ResolveInfo resolveInfo = serviceInfo.getResolveInfo();
+ if ((serviceInfo.getCapabilities()
+ & AccessibilityServiceInfo.CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION) == 0
+ && resolveInfo.serviceInfo.applicationInfo.targetSdkVersion
+ <= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+ ComponentName componentName = new ComponentName(
+ resolveInfo.serviceInfo.packageName, resolveInfo.serviceInfo.name);
+ if (userState.mTouchExplorationGrantedServices.contains(componentName)) {
+ serviceInfo.setCapabilities(serviceInfo.getCapabilities()
+ | AccessibilityServiceInfo.CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION);
+ }
+ }
+ }
+ }
+
private void updateServicesLocked(UserState userState) {
if (userState.mIsAccessibilityEnabled) {
manageServicesLocked(userState);
@@ -1658,8 +1681,6 @@
Intent mIntent;
- boolean mCanRetrieveScreenContent;
-
boolean mIsAutomation;
final Rect mTempBounds = new Rect();
@@ -1695,15 +1716,11 @@
mAccessibilityServiceInfo = accessibilityServiceInfo;
mIsAutomation = (sFakeAccessibilityServiceComponentName.equals(componentName));
if (!mIsAutomation) {
- mCanRetrieveScreenContent = (accessibilityServiceInfo.getCapabilities()
- & AccessibilityServiceInfo.CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION) != 0;
mIntent = new Intent().setComponent(mComponentName);
mIntent.putExtra(Intent.EXTRA_CLIENT_LABEL,
com.android.internal.R.string.accessibility_binding_label);
mIntent.putExtra(Intent.EXTRA_CLIENT_INTENT, PendingIntent.getActivity(
mContext, 0, new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS), 0));
- } else {
- mCanRetrieveScreenContent = true;
}
setDynamicallyConfigurableProperties(accessibilityServiceInfo);
}
@@ -2152,7 +2169,7 @@
.loadLabel(mContext.getPackageManager()));
pw.append(", feedbackType"
+ AccessibilityServiceInfo.feedbackTypeToString(mFeedbackType));
- pw.append(", canRetrieveScreenContent=" + mCanRetrieveScreenContent);
+ pw.append(", capabilities=" + mAccessibilityServiceInfo.getCapabilities());
pw.append(", eventTypes="
+ AccessibilityEvent.eventTypeToString(mEventTypes));
pw.append(", notificationTimeout=" + mNotificationTimeout);
@@ -2742,7 +2759,8 @@
}
public boolean canRetrieveWindowContent(Service service) {
- return service.mCanRetrieveScreenContent;
+ return (service.mAccessibilityServiceInfo.getCapabilities()
+ & AccessibilityServiceInfo.CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT) != 0;
}
public void enforceCanRetrieveWindowContent(Service service) throws RemoteException {
diff --git a/services/java/com/android/server/firewall/IntentFirewall.java b/services/java/com/android/server/firewall/IntentFirewall.java
index edba243..4496aae 100644
--- a/services/java/com/android/server/firewall/IntentFirewall.java
+++ b/services/java/com/android/server/firewall/IntentFirewall.java
@@ -107,6 +107,7 @@
public IntentFirewall(AMSInterface ams) {
mAms = ams;
File rulesFile = getRulesFile();
+ rulesFile.getParentFile().mkdirs();
readRules(rulesFile);
diff --git a/services/java/com/android/server/power/ElectronBeam.java b/services/java/com/android/server/power/ElectronBeam.java
index 4a74149..379e704 100644
--- a/services/java/com/android/server/power/ElectronBeam.java
+++ b/services/java/com/android/server/power/ElectronBeam.java
@@ -389,10 +389,14 @@
mTexNamesGenerated = true;
}
- SurfaceTexture st = new SurfaceTexture(mTexNames[0]);
- SurfaceControl.screenshot(SurfaceControl.getBuiltInDisplay(
- SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN),
- new Surface(st));
+ final SurfaceTexture st = new SurfaceTexture(mTexNames[0]);
+ final Surface s = new Surface(st);
+ try {
+ SurfaceControl.screenshot(SurfaceControl.getBuiltInDisplay(
+ SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN), s);
+ } finally {
+ s.release();
+ }
st.updateTexImage();
st.getTransformMatrix(mTexMatrix);