Merge "SoundTriggerHelper: Add ability to manage multiple voice models." into nyc-dev
diff --git a/api/current.txt b/api/current.txt
index c1dbce7..2fb21fb 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -891,6 +891,7 @@
field public static final int notificationTimeout = 16843651; // 0x1010383
field public static final int numColumns = 16843032; // 0x1010118
field public static final int numStars = 16843076; // 0x1010144
+ field public static final int numberPickerStyle = 16844071; // 0x1010527
field public static final int numbersBackgroundColor = 16843938; // 0x10104a2
field public static final int numbersInnerTextColor = 16844001; // 0x10104e1
field public static final int numbersSelectorColor = 16843939; // 0x10104a3
@@ -2534,6 +2535,7 @@
field public static final int Widget_Material_Light_ListView = 16974513; // 0x10302b1
field public static final int Widget_Material_Light_ListView_DropDown = 16974514; // 0x10302b2
field public static final int Widget_Material_Light_MediaRouteButton = 16974515; // 0x10302b3
+ field public static final int Widget_Material_Light_NumberPicker = 16974557; // 0x10302dd
field public static final int Widget_Material_Light_PopupMenu = 16974516; // 0x10302b4
field public static final int Widget_Material_Light_PopupMenu_Overflow = 16974517; // 0x10302b5
field public static final int Widget_Material_Light_PopupWindow = 16974518; // 0x10302b6
@@ -2566,6 +2568,7 @@
field public static final int Widget_Material_ListView = 16974448; // 0x1030270
field public static final int Widget_Material_ListView_DropDown = 16974449; // 0x1030271
field public static final int Widget_Material_MediaRouteButton = 16974450; // 0x1030272
+ field public static final int Widget_Material_NumberPicker = 16974556; // 0x10302dc
field public static final int Widget_Material_PopupMenu = 16974451; // 0x1030273
field public static final int Widget_Material_PopupMenu_Overflow = 16974452; // 0x1030274
field public static final int Widget_Material_PopupWindow = 16974453; // 0x1030275
@@ -34957,6 +34960,7 @@
method public void onDestroy();
method public boolean[] onGetSupportedCommands(java.lang.String[]);
method public void onHandleAssist(android.os.Bundle, android.app.assist.AssistStructure, android.app.assist.AssistContent);
+ method public void onHandleAssistSecondary(android.os.Bundle, android.app.assist.AssistStructure, android.app.assist.AssistContent, int, int);
method public void onHandleScreenshot(android.graphics.Bitmap);
method public void onHide();
method public boolean onKeyDown(int, android.view.KeyEvent);
diff --git a/api/system-current.txt b/api/system-current.txt
index 9a39b4c..b51e8ef 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -988,6 +988,7 @@
field public static final int notificationTimeout = 16843651; // 0x1010383
field public static final int numColumns = 16843032; // 0x1010118
field public static final int numStars = 16843076; // 0x1010144
+ field public static final int numberPickerStyle = 16844071; // 0x1010527
field public static final int numbersBackgroundColor = 16843938; // 0x10104a2
field public static final int numbersInnerTextColor = 16844001; // 0x10104e1
field public static final int numbersSelectorColor = 16843939; // 0x10104a3
@@ -2638,6 +2639,7 @@
field public static final int Widget_Material_Light_ListView = 16974513; // 0x10302b1
field public static final int Widget_Material_Light_ListView_DropDown = 16974514; // 0x10302b2
field public static final int Widget_Material_Light_MediaRouteButton = 16974515; // 0x10302b3
+ field public static final int Widget_Material_Light_NumberPicker = 16974557; // 0x10302dd
field public static final int Widget_Material_Light_PopupMenu = 16974516; // 0x10302b4
field public static final int Widget_Material_Light_PopupMenu_Overflow = 16974517; // 0x10302b5
field public static final int Widget_Material_Light_PopupWindow = 16974518; // 0x10302b6
@@ -2670,6 +2672,7 @@
field public static final int Widget_Material_ListView = 16974448; // 0x1030270
field public static final int Widget_Material_ListView_DropDown = 16974449; // 0x1030271
field public static final int Widget_Material_MediaRouteButton = 16974450; // 0x1030272
+ field public static final int Widget_Material_NumberPicker = 16974556; // 0x10302dc
field public static final int Widget_Material_PopupMenu = 16974451; // 0x1030273
field public static final int Widget_Material_PopupMenu_Overflow = 16974452; // 0x1030274
field public static final int Widget_Material_PopupWindow = 16974453; // 0x1030275
@@ -37531,6 +37534,7 @@
method public void onDestroy();
method public boolean[] onGetSupportedCommands(java.lang.String[]);
method public void onHandleAssist(android.os.Bundle, android.app.assist.AssistStructure, android.app.assist.AssistContent);
+ method public void onHandleAssistSecondary(android.os.Bundle, android.app.assist.AssistStructure, android.app.assist.AssistContent, int, int);
method public void onHandleScreenshot(android.graphics.Bitmap);
method public void onHide();
method public boolean onKeyDown(int, android.view.KeyEvent);
diff --git a/api/test-current.txt b/api/test-current.txt
index 6895d48..4eeeee4 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -891,6 +891,7 @@
field public static final int notificationTimeout = 16843651; // 0x1010383
field public static final int numColumns = 16843032; // 0x1010118
field public static final int numStars = 16843076; // 0x1010144
+ field public static final int numberPickerStyle = 16844071; // 0x1010527
field public static final int numbersBackgroundColor = 16843938; // 0x10104a2
field public static final int numbersInnerTextColor = 16844001; // 0x10104e1
field public static final int numbersSelectorColor = 16843939; // 0x10104a3
@@ -2534,6 +2535,7 @@
field public static final int Widget_Material_Light_ListView = 16974513; // 0x10302b1
field public static final int Widget_Material_Light_ListView_DropDown = 16974514; // 0x10302b2
field public static final int Widget_Material_Light_MediaRouteButton = 16974515; // 0x10302b3
+ field public static final int Widget_Material_Light_NumberPicker = 16974557; // 0x10302dd
field public static final int Widget_Material_Light_PopupMenu = 16974516; // 0x10302b4
field public static final int Widget_Material_Light_PopupMenu_Overflow = 16974517; // 0x10302b5
field public static final int Widget_Material_Light_PopupWindow = 16974518; // 0x10302b6
@@ -2566,6 +2568,7 @@
field public static final int Widget_Material_ListView = 16974448; // 0x1030270
field public static final int Widget_Material_ListView_DropDown = 16974449; // 0x1030271
field public static final int Widget_Material_MediaRouteButton = 16974450; // 0x1030272
+ field public static final int Widget_Material_NumberPicker = 16974556; // 0x10302dc
field public static final int Widget_Material_PopupMenu = 16974451; // 0x1030273
field public static final int Widget_Material_PopupMenu_Overflow = 16974452; // 0x1030274
field public static final int Widget_Material_PopupWindow = 16974453; // 0x1030275
@@ -35032,6 +35035,7 @@
method public void onDestroy();
method public boolean[] onGetSupportedCommands(java.lang.String[]);
method public void onHandleAssist(android.os.Bundle, android.app.assist.AssistStructure, android.app.assist.AssistContent);
+ method public void onHandleAssistSecondary(android.os.Bundle, android.app.assist.AssistStructure, android.app.assist.AssistContent, int, int);
method public void onHandleScreenshot(android.graphics.Bitmap);
method public void onHide();
method public boolean onKeyDown(int, android.view.KeyEvent);
diff --git a/core/java/android/app/ActivityManagerInternal.java b/core/java/android/app/ActivityManagerInternal.java
index 5116634..374c4f6 100644
--- a/core/java/android/app/ActivityManagerInternal.java
+++ b/core/java/android/app/ActivityManagerInternal.java
@@ -23,6 +23,8 @@
import com.android.internal.app.IVoiceInteractor;
+import java.util.List;
+
/**
* Activity manager local system service interface.
*
@@ -125,4 +127,10 @@
* Callback for window manager to let activity manager know that the app transition is finished.
*/
public abstract void notifyAppTransitionFinished();
+
+ /**
+ * Returns the top activity from each of the currently visible stacks. The first entry will be
+ * the focused activity.
+ */
+ public abstract List<IBinder> getTopVisibleActivities();
}
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 65d48e6..7bf03de 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -2411,8 +2411,11 @@
data.enforceInterface(IActivityManager.descriptor);
int requestType = data.readInt();
IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
+ Bundle receiverExtras = data.readBundle();
IBinder activityToken = data.readStrongBinder();
- boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
+ boolean focused = data.readInt() == 1;
+ boolean res = requestAssistContextExtras(requestType, receiver, receiverExtras,
+ activityToken, focused);
reply.writeNoException();
reply.writeInt(res ? 1 : 0);
return true;
@@ -6080,13 +6083,16 @@
}
public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
- IBinder activityToken) throws RemoteException {
+ Bundle receiverExtras,
+ IBinder activityToken, boolean focused) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
data.writeInt(requestType);
data.writeStrongBinder(receiver.asBinder());
+ data.writeBundle(receiverExtras);
data.writeStrongBinder(activityToken);
+ data.writeInt(focused ? 1 : 0);
mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
reply.readException();
boolean res = reply.readInt() != 0;
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index 8ee6fd0..6975116 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -523,7 +523,8 @@
public Bundle getAssistContextExtras(int requestType) throws RemoteException;
public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
- IBinder activityToken) throws RemoteException;
+ Bundle receiverExtras,
+ IBinder activityToken, boolean focused) throws RemoteException;
public void reportAssistContextExtras(IBinder token, Bundle extras,
AssistStructure structure, AssistContent content, Uri referrer) throws RemoteException;
diff --git a/core/java/android/service/voice/IVoiceInteractionSession.aidl b/core/java/android/service/voice/IVoiceInteractionSession.aidl
index dbc28f7..78e6bc3 100644
--- a/core/java/android/service/voice/IVoiceInteractionSession.aidl
+++ b/core/java/android/service/voice/IVoiceInteractionSession.aidl
@@ -30,7 +30,8 @@
oneway interface IVoiceInteractionSession {
void show(in Bundle sessionArgs, int flags, IVoiceInteractionSessionShowCallback showCallback);
void hide();
- void handleAssist(in Bundle assistData, in AssistStructure structure, in AssistContent content);
+ void handleAssist(in Bundle assistData, in AssistStructure structure, in AssistContent content,
+ int index, int count);
void handleScreenshot(in Bitmap screenshot);
void taskStarted(in Intent intent, int taskId);
void taskFinished(in Intent intent, int taskId);
diff --git a/core/java/android/service/voice/VoiceInteractionSession.java b/core/java/android/service/voice/VoiceInteractionSession.java
index 6ff9fe7..e354ab3 100644
--- a/core/java/android/service/voice/VoiceInteractionSession.java
+++ b/core/java/android/service/voice/VoiceInteractionSession.java
@@ -77,7 +77,7 @@
*/
public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCallbacks2 {
static final String TAG = "VoiceInteractionSession";
- static final boolean DEBUG = true;
+ static final boolean DEBUG = false;
/**
* Flag received in {@link #onShow}: originator requested that the session be started with
@@ -110,6 +110,16 @@
*/
public static final int SHOW_SOURCE_ACTIVITY = 1<<4;
+ // Keys for Bundle values
+ /** @hide */
+ public static final String KEY_DATA = "data";
+ /** @hide */
+ public static final String KEY_STRUCTURE = "structure";
+ /** @hide */
+ public static final String KEY_CONTENT = "content";
+ /** @hide */
+ public static final String KEY_RECEIVER_EXTRAS = "receiverExtras";
+
final Context mContext;
final HandlerCaller mHandlerCaller;
@@ -229,7 +239,7 @@
@Override
public void handleAssist(final Bundle data, final AssistStructure structure,
- final AssistContent content) {
+ final AssistContent content, final int index, final int count) {
// We want to pre-warm the AssistStructure before handing it off to the main
// thread. We also want to do this on a separate thread, so that if the app
// is for some reason slow (due to slow filling in of async children in the
@@ -247,8 +257,9 @@
failure = e;
}
}
- mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageOOOO(MSG_HANDLE_ASSIST,
- data, failure == null ? structure : null, failure, content));
+ mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageOOOOII(MSG_HANDLE_ASSIST,
+ data, failure == null ? structure : null, failure, content,
+ index, count));
}
};
retriever.start();
@@ -831,9 +842,16 @@
case MSG_HANDLE_ASSIST:
args = (SomeArgs)msg.obj;
if (DEBUG) Log.d(TAG, "onHandleAssist: data=" + args.arg1
- + " structure=" + args.arg2 + " content=" + args.arg3);
- doOnHandleAssist((Bundle) args.arg1, (AssistStructure) args.arg2,
- (Throwable) args.arg3, (AssistContent) args.arg4);
+ + " structure=" + args.arg2 + " content=" + args.arg3
+ + " activityIndex=" + args.argi5 + " activityCount=" + args.argi6);
+ if (args.argi5 == 0) {
+ doOnHandleAssist((Bundle) args.arg1, (AssistStructure) args.arg2,
+ (Throwable) args.arg3, (AssistContent) args.arg4);
+ } else {
+ doOnHandleAssistSecondary((Bundle) args.arg1, (AssistStructure) args.arg2,
+ (Throwable) args.arg3, (AssistContent) args.arg4,
+ args.argi5, args.argi6);
+ }
break;
case MSG_HANDLE_SCREENSHOT:
if (DEBUG) Log.d(TAG, "onHandleScreenshot: " + msg.obj);
@@ -1320,6 +1338,14 @@
onHandleAssist(data, structure, content);
}
+ void doOnHandleAssistSecondary(Bundle data, AssistStructure structure, Throwable failure,
+ AssistContent content, int index, int count) {
+ if (failure != null) {
+ onAssistStructureFailure(failure);
+ }
+ onHandleAssistSecondary(data, structure, content, index, count);
+ }
+
/**
* Called when there has been a failure transferring the {@link AssistStructure} to
* the assistant. This may happen, for example, if the data is too large and results
@@ -1356,6 +1382,45 @@
}
/**
+ * Called to receive data from other applications that the user was or is interacting with,
+ * that are currently on the screen in a multi-window display environment, not including the
+ * currently focused activity. This could be
+ * a free-form window, a picture-in-picture window, or another window in a split-screen display.
+ * <p>
+ * This method is very similar to
+ * {@link #onHandleAssist} except that it is called
+ * for additional non-focused activities along with an index and count that indicates
+ * which additional activity the data is for. {@code index} will be between 1 and
+ * {@code count}-1 and this method is called once for each additional window, in no particular
+ * order. The {@code count} indicates how many windows to expect assist data for, including the
+ * top focused activity, which continues to be returned via {@link #onHandleAssist}.
+ * <p>
+ * To be responsive to assist requests, process assist data as soon as it is received,
+ * without waiting for all queued activities to return assist data.
+ *
+ * @param data Arbitrary data supplied by the app through
+ * {@link android.app.Activity#onProvideAssistData Activity.onProvideAssistData}.
+ * May be null if assist data has been disabled by the user or device policy.
+ * @param structure If available, the structure definition of all windows currently
+ * displayed by the app. May be null if assist data has been disabled by the user
+ * or device policy; will be an empty stub if the application has disabled assist
+ * by marking its window as secure.
+ * @param content Additional content data supplied by the app through
+ * {@link android.app.Activity#onProvideAssistContent Activity.onProvideAssistContent}.
+ * May be null if assist data has been disabled by the user or device policy; will
+ * not be automatically filled in with data from the app if the app has marked its
+ * window as secure.
+ * @param index the index of the additional activity that this data
+ * is for.
+ * @param count the total number of additional activities for which the assist data is being
+ * returned, including the focused activity that is returned via
+ * {@link #onHandleAssist}.
+ */
+ public void onHandleAssistSecondary(@Nullable Bundle data, @Nullable AssistStructure structure,
+ @Nullable AssistContent content, int index, int count) {
+ }
+
+ /**
* Called to receive a screenshot of what the user was currently viewing when an assist
* session is started. May be null if screenshots are disabled by the user, policy,
* or application. If the original show request did not specify
diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java
index af46756..bb883ea 100644
--- a/core/java/android/widget/PopupWindow.java
+++ b/core/java/android/widget/PopupWindow.java
@@ -1512,6 +1512,24 @@
outParams.x = drawingLocation[0] + xOffset;
outParams.y = drawingLocation[1] + anchorHeight + yOffset;
+ // Let the window manager know to align the top to y.
+ outParams.gravity = Gravity.LEFT | Gravity.TOP;
+ outParams.width = width;
+ outParams.height = height;
+
+ // If width or height is unspecified. We can leave it to the window manager to match
+ // to the parent size, but for our local purposes of calculating positioning, we need
+ // to fill in real width and height values.
+ final Rect displayFrame = new Rect();
+ anchor.getWindowVisibleDisplayFrame(displayFrame);
+ if (width < 0) {
+ width = displayFrame.right - displayFrame.left;
+ }
+ if (height < 0) {
+ height = displayFrame.bottom - displayFrame.top;
+ }
+
+
// If we need to adjust for gravity RIGHT, align to the bottom-right
// corner of the anchor (still accounting for offsets).
final int hgrav = Gravity.getAbsoluteGravity(gravity, anchor.getLayoutDirection())
@@ -1520,17 +1538,9 @@
outParams.x -= width - anchorWidth;
}
- // Let the window manager know to align the top to y.
- outParams.gravity = Gravity.LEFT | Gravity.TOP;
- outParams.width = width;
- outParams.height = height;
-
final int[] screenLocation = mTmpScreenLocation;
anchor.getLocationOnScreen(screenLocation);
- final Rect displayFrame = new Rect();
- anchor.getWindowVisibleDisplayFrame(displayFrame);
-
// First, attempt to fit the popup vertically without resizing.
final boolean fitsVertical = tryFitVertical(outParams, yOffset, height,
anchorHeight, drawingLocation[1], screenLocation[1], displayFrame.top,
@@ -2114,10 +2124,10 @@
// If an explicit width/height has not specified, use the most recent
// explicitly specified value (either from setWidth/Height or update).
- if (width == -1) {
+ if (width < 0) {
width = mWidth;
}
- if (height == -1) {
+ if (height < 0) {
height = mHeight;
}
diff --git a/core/java/com/android/internal/os/HandlerCaller.java b/core/java/com/android/internal/os/HandlerCaller.java
index 113768e..c26fc3a 100644
--- a/core/java/com/android/internal/os/HandlerCaller.java
+++ b/core/java/com/android/internal/os/HandlerCaller.java
@@ -209,6 +209,18 @@
return mH.obtainMessage(what, 0, 0, args);
}
+ public Message obtainMessageOOOOII(int what, Object arg1, Object arg2,
+ Object arg3, Object arg4, int arg5, int arg6) {
+ SomeArgs args = SomeArgs.obtain();
+ args.arg1 = arg1;
+ args.arg2 = arg2;
+ args.arg3 = arg3;
+ args.arg4 = arg4;
+ args.argi5 = arg5;
+ args.argi6 = arg6;
+ return mH.obtainMessage(what, 0, 0, args);
+ }
+
public Message obtainMessageIIII(int what, int arg1, int arg2,
int arg3, int arg4) {
SomeArgs args = SomeArgs.obtain();
@@ -218,7 +230,7 @@
args.argi4 = arg4;
return mH.obtainMessage(what, 0, 0, args);
}
-
+
public Message obtainMessageIIIIII(int what, int arg1, int arg2,
int arg3, int arg4, int arg5, int arg6) {
SomeArgs args = SomeArgs.obtain();
@@ -230,7 +242,7 @@
args.argi6 = arg6;
return mH.obtainMessage(what, 0, 0, args);
}
-
+
public Message obtainMessageIIIIO(int what, int arg1, int arg2,
int arg3, int arg4, Object arg5) {
SomeArgs args = SomeArgs.obtain();
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 6ff7139..80b3a64 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2713,11 +2713,14 @@
<public type="attr" name="forceHasOverlappingRendering" />
<public type="attr" name="contentInsetStartWithNavigation" />
<public type="attr" name="contentInsetEndWithActions" />
+ <public type="attr" name="numberPickerStyle" />
<public type="style" name="Theme.Material.Light.DialogWhenLarge.DarkActionBar" />
<public type="style" name="Widget.Material.SeekBar.Discrete" />
<public type="style" name="Widget.Material.CompoundButton.Switch" />
<public type="style" name="Widget.Material.Light.CompoundButton.Switch" />
+ <public type="style" name="Widget.Material.NumberPicker" />
+ <public type="style" name="Widget.Material.Light.NumberPicker" />
<public type="id" name="accessibilityActionSetProgress" />
<public type="id" name="icon_frame" />
diff --git a/media/java/android/media/tv/TvInputManager.java b/media/java/android/media/tv/TvInputManager.java
index d74dda6..bfd938e 100644
--- a/media/java/android/media/tv/TvInputManager.java
+++ b/media/java/android/media/tv/TvInputManager.java
@@ -483,26 +483,19 @@
}
/**
- * This is called when the start playback position is changed.
- *
- * <p>The start playback position of the time shifted program should be adjusted when the TV
- * input cannot retain the whole recorded program due to some reason (e.g. limitation on
- * storage space). This is necessary to prevent the application from allowing the user to
- * seek to a time position that is not reachable.
+ * This is called when the start position for time shifting has changed.
*
* @param session A {@link TvInputManager.Session} associated with this callback.
- * @param timeMs The start playback position of the time shifted program, in milliseconds
- * since the epoch.
+ * @param timeMs The start position for time shifting, in milliseconds since the epoch.
*/
public void onTimeShiftStartPositionChanged(Session session, long timeMs) {
}
/**
- * This is called when the current playback position is changed.
+ * This is called when the current position for time shifting is changed.
*
* @param session A {@link TvInputManager.Session} associated with this callback.
- * @param timeMs The current playback position of the time shifted program, in milliseconds
- * since the epoch.
+ * @param timeMs The current position for time shifting, in milliseconds since the epoch.
*/
public void onTimeShiftCurrentPositionChanged(Session session, long timeMs) {
}
diff --git a/media/java/android/media/tv/TvInputService.java b/media/java/android/media/tv/TvInputService.java
index 3780f6f..e134635 100644
--- a/media/java/android/media/tv/TvInputService.java
+++ b/media/java/android/media/tv/TvInputService.java
@@ -996,15 +996,18 @@
}
/**
- * Returns the start playback position for time shifting, in milliseconds since the epoch.
+ * Returns the start position for time shifting, in milliseconds since the epoch.
* Returns {@link TvInputManager#TIME_SHIFT_INVALID_TIME} if the position is unknown at the
* moment.
*
- * <p>The start playback position of the time shifted program should be adjusted when the
- * implementation cannot retain the whole recorded program due to some reason (e.g.
- * limitation on storage space). It is the earliest possible time position that the user can
- * seek to, thus failure to notifying its change immediately might result in bad experience
- * where the application allows the user to seek to an invalid time position.
+ * <p>The start position for time shifting indicates the earliest possible time the user can
+ * seek to. Initially this is equivalent to the time when the implementation starts
+ * recording. Later it may be adjusted because there is insufficient space or the duration
+ * of recording is limited by the implementation. The application does not allow the user to
+ * seek to a position earlier than the start position.
+ *
+ * <p>For playback of a recorded program initiated by {@link #onTimeShiftPlay(Uri)}, the
+ * start position is the time when playback starts. It does not change.
*
* @see #onTimeShiftPlay(Uri)
* @see #onTimeShiftResume()
@@ -1018,13 +1021,13 @@
}
/**
- * Returns the current playback position for time shifting, in milliseconds since the epoch.
+ * Returns the current position for time shifting, in milliseconds since the epoch.
* Returns {@link TvInputManager#TIME_SHIFT_INVALID_TIME} if the position is unknown at the
* moment.
*
- * <p>Note that the current playback position should be equal to or greater than the start
- * playback position reported by {@link #onTimeShiftGetStartPosition}. Failure to notifying
- * the correct current position might lead to bad user experience.
+ * <p>The current position for time shifting is the same as the current position of
+ * playback. It should be equal to or greater than the start position reported by
+ * {@link #onTimeShiftGetStartPosition()}.
*
* @see #onTimeShiftPlay(Uri)
* @see #onTimeShiftResume()
diff --git a/media/java/android/media/tv/TvView.java b/media/java/android/media/tv/TvView.java
index 71b0193..10cec1f 100644
--- a/media/java/android/media/tv/TvView.java
+++ b/media/java/android/media/tv/TvView.java
@@ -848,32 +848,34 @@
public abstract static class TimeShiftPositionCallback {
/**
- * This is called when the start playback position is changed.
+ * This is called when the start position for time shifting has changed.
*
- * <p>The start playback position of the time shifted program can be adjusted by the TV
- * input when it cannot retain the whole recorded program due to some reason (e.g.
- * limitation on storage space). The application should not allow the user to seek to a
- * position earlier than the start position.
+ * <p>The start position for time shifting indicates the earliest possible time the user can
+ * seek to. Initially this is equivalent to the time when the underlying TV input starts
+ * recording. Later it may be adjusted because there is insufficient space or the duration
+ * of recording is limited. The application must not allow the user to seek to a position
+ * earlier than the start position.
*
- * <p>Note that {@code timeMs} is not relative time in the program but wall-clock time,
- * which is intended to avoid calling this method unnecessarily around program boundaries.
+ * <p>For playback of a recorded program initiated by {@link #timeShiftPlay(String, Uri)},
+ * the start position is the time when playback starts. It does not change.
*
* @param inputId The ID of the TV input bound to this view.
- * @param timeMs The start playback position of the time shifted program, in milliseconds
- * since the epoch.
+ * @param timeMs The start position for time shifting, in milliseconds since the epoch.
*/
public void onTimeShiftStartPositionChanged(String inputId, long timeMs) {
}
/**
- * This is called when the current playback position is changed.
+ * This is called when the current position for time shifting has changed.
*
- * <p>Note that {@code timeMs} is not relative time in the program but wall-clock time,
- * which is intended to avoid calling this method unnecessarily around program boundaries.
+ * <p>The current position for time shifting is the same as the current position of
+ * playback. During playback, the current position changes continuously. When paused, it
+ * does not change.
+ *
+ * <p>Note that {@code timeMs} is wall-clock time.
*
* @param inputId The ID of the TV input bound to this view.
- * @param timeMs The current playback position of the time shifted program, in milliseconds
- * since the epoch.
+ * @param timeMs The current position for time shifting, in milliseconds since the epoch.
*/
public void onTimeShiftCurrentPositionChanged(String inputId, long timeMs) {
}
diff --git a/packages/DocumentsUI/src/com/android/documentsui/services/FileOperationService.java b/packages/DocumentsUI/src/com/android/documentsui/services/FileOperationService.java
index 580fa38..871e135 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/services/FileOperationService.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/services/FileOperationService.java
@@ -229,31 +229,32 @@
@OpType int operationType, String id, List<DocumentInfo> srcs, DocumentInfo srcParent,
DocumentStack stack) {
+ if (srcs.isEmpty()) {
+ Log.w(TAG, "Ignoring job request with empty srcs list. Id: " + id);
+ return null;
+ }
+
if (mRunning.containsKey(id)) {
Log.w(TAG, "Duplicate job id: " + id
+ ". Ignoring job request for srcs: " + srcs + ", stack: " + stack + ".");
return null;
}
- Job job = null;
switch (operationType) {
case OPERATION_COPY:
- job = jobFactory.createCopy(this, getApplicationContext(), this, id, stack, srcs);
- break;
+ return jobFactory.createCopy(
+ this, getApplicationContext(), this, id, stack, srcs);
case OPERATION_MOVE:
- job = jobFactory.createMove(this, getApplicationContext(), this, id, stack, srcs,
+ return jobFactory.createMove(
+ this, getApplicationContext(), this, id, stack, srcs,
srcParent);
- break;
case OPERATION_DELETE:
- job = jobFactory.createDelete(this, getApplicationContext(), this, id, stack, srcs,
+ return jobFactory.createDelete(
+ this, getApplicationContext(), this, id, stack, srcs,
srcParent);
- break;
default:
throw new UnsupportedOperationException();
}
-
- assert(job != null);
- return job;
}
@GuardedBy("mRunning")
diff --git a/packages/DocumentsUI/src/com/android/documentsui/services/Job.java b/packages/DocumentsUI/src/com/android/documentsui/services/Job.java
index c723ac6..b4f1299 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/services/Job.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/services/Job.java
@@ -291,18 +291,24 @@
Job createCopy(Context service, Context appContext, Listener listener,
String id, DocumentStack stack, List<DocumentInfo> srcs) {
+ assert(!srcs.isEmpty());
+ assert(stack.peek().isCreateSupported());
return new CopyJob(service, appContext, listener, id, stack, srcs);
}
Job createMove(Context service, Context appContext, Listener listener,
String id, DocumentStack stack, List<DocumentInfo> srcs,
DocumentInfo srcParent) {
+ assert(!srcs.isEmpty());
+ assert(stack.peek().isCreateSupported());
return new MoveJob(service, appContext, listener, id, stack, srcs, srcParent);
}
Job createDelete(Context service, Context appContext, Listener listener,
String id, DocumentStack stack, List<DocumentInfo> srcs,
DocumentInfo srcParent) {
+ assert(!srcs.isEmpty());
+ assert(stack.peek().isDirectory()); // we can't currently delete from archives.
return new DeleteJob(service, appContext, listener, id, stack, srcs, srcParent);
}
}
diff --git a/packages/DocumentsUI/tests/src/com/android/documentsui/services/FileOperationServiceTest.java b/packages/DocumentsUI/tests/src/com/android/documentsui/services/FileOperationServiceTest.java
index 4d5392e..96d963f 100644
--- a/packages/DocumentsUI/tests/src/com/android/documentsui/services/FileOperationServiceTest.java
+++ b/packages/DocumentsUI/tests/src/com/android/documentsui/services/FileOperationServiceTest.java
@@ -79,6 +79,16 @@
mJobFactory.assertAllJobsStarted();
}
+ public void testRunsJobs_AfterExceptionInJobCreation() throws Exception {
+ startService(createCopyIntent(new ArrayList<DocumentInfo>(), BETA_DOC));
+ startService(createCopyIntent(newArrayList(GAMMA_DOC), DELTA_DOC));
+
+ mJobFactory.assertJobsCreated(1);
+
+ mExecutor.runAll();
+ mJobFactory.assertAllJobsStarted();
+ }
+
public void testRunsJobs_AfterFailure() throws Exception {
startService(createCopyIntent(newArrayList(ALPHA_DOC), BETA_DOC));
startService(createCopyIntent(newArrayList(GAMMA_DOC), DELTA_DOC));
@@ -182,9 +192,18 @@
}
}
+ void assertJobsCreated(int expected) {
+ assertEquals(expected, jobs.size());
+ }
+
@Override
Job createCopy(Context service, Context appContext, Listener listener, String id,
DocumentStack stack, List<DocumentInfo> srcs) {
+
+ if (srcs.isEmpty()) {
+ throw new RuntimeException("Empty srcs not supported!");
+ }
+
TestJob job = new TestJob(service, appContext, listener, OPERATION_COPY, id, stack);
jobs.add(job);
return job;
diff --git a/packages/SystemUI/res/layout-television/recents_on_tv.xml b/packages/SystemUI/res/layout-television/recents_on_tv.xml
index 280fd20..1dbd1b3 100644
--- a/packages/SystemUI/res/layout-television/recents_on_tv.xml
+++ b/packages/SystemUI/res/layout-television/recents_on_tv.xml
@@ -35,9 +35,9 @@
<!-- Placeholder view to give focus to the PIP menus. -->
<View
android:id="@+id/pip"
- android:layout_width="0dp"
- android:layout_height="0dp"
+ android:layout_width="1dp"
+ android:layout_height="1dp"
android:focusable="true"
- android:visibility="gone" />
+ android:visibility="visible" />
</com.android.systemui.recents.tv.views.RecentsTvView>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index cf2e338..03b9837 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -606,8 +606,8 @@
<dimen name="recents_layout_z_min">3dp</dimen>
<dimen name="recents_layout_z_max">24dp</dimen>
- <!-- The margin between the freeform and stack. We also don't want this to change across
- configurations that Recents can be opened in, so we define them statically for all
+ <!-- The margin between the freeform and stack. We also don't want this to change across
+ configurations that Recents can be opened in, so we define them statically for all
display sizes. -->
<dimen name="recents_freeform_layout_bottom_margin">16dp</dimen>
@@ -651,4 +651,7 @@
<!-- The amount to translate when animating the removal of a task. -->
<dimen name="recents_task_view_remove_anim_translation_x">100dp</dimen>
+
+ <!-- The alpha to apply to the recents row when it doesn't have focus -->
+ <item name="recents_recents_row_dim_alpha" format="float" type="dimen">0.5</item>
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/recents/tv/RecentsTvActivity.java b/packages/SystemUI/src/com/android/systemui/recents/tv/RecentsTvActivity.java
index 60a85df..7378102 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/tv/RecentsTvActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/tv/RecentsTvActivity.java
@@ -107,7 +107,9 @@
public void onMoveToFullscreen() {
// Recents should be dismissed when PIP moves to fullscreen. If not, Recents will
// be unnecessarily shown in the scenario: PIP->Fullscreen->PIP.
- dismissRecentsToLaunchTargetTaskOrHome();
+ // Do not show Recents close animation because PIP->Fullscreen animation will be shown
+ // instead.
+ dismissRecentsToLaunchTargetTaskOrHome(false);
}
@Override
@@ -118,7 +120,7 @@
new PipRecentsOverlayManager.Callback() {
@Override
public void onClosed() {
- dismissRecentsToLaunchTargetTaskOrHome();
+ dismissRecentsToLaunchTargetTaskOrHome(true);
}
@Override
@@ -211,13 +213,15 @@
}
}
- boolean dismissRecentsToLaunchTargetTaskOrHome() {
+ boolean dismissRecentsToLaunchTargetTaskOrHome(boolean animate) {
SystemServicesProxy ssp = Recents.getSystemServices();
if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) {
// If we have a focused Task, launch that Task now
- if (mRecentsView.launchPreviousTask()) return true;
+ if (mRecentsView.launchPreviousTask(animate)) {
+ return true;
+ }
// If none of the other cases apply, then just go Home
- dismissRecentsToHome(true /* animateTaskViews */);
+ dismissRecentsToHome(animate /* animateTaskViews */);
}
return false;
}
@@ -247,7 +251,7 @@
dismissEvent.addPostAnimationCallback(mFinishLaunchHomeRunnable);
dismissEvent.addPostAnimationCallback(closeSystemWindows);
- if(mTaskStackHorizontalGridView.getChildCount() > 0 && animateTaskViews) {
+ if (mTaskStackHorizontalGridView.getChildCount() > 0 && animateTaskViews) {
mHomeRecentsEnterExitAnimationHolder.startExitAnimation(dismissEvent);
} else {
closeSystemWindows.run();
@@ -374,7 +378,7 @@
public void onEnterAnimationComplete() {
super.onEnterAnimationComplete();
if(mLaunchedFromHome) {
- mHomeRecentsEnterExitAnimationHolder.startEnterAnimation();
+ mHomeRecentsEnterExitAnimationHolder.startEnterAnimation(mPipManager.isPipShown());
}
EventBus.getDefault().send(new EnterRecentsWindowAnimationCompletedEvent());
}
@@ -463,7 +467,7 @@
if (launchState.launchedFromHome) {
dismissRecentsToHome(true /* animateTaskViews */);
} else {
- dismissRecentsToLaunchTargetTaskOrHome();
+ dismissRecentsToLaunchTargetTaskOrHome(true);
}
}
@@ -561,6 +565,8 @@
// as if it's the part of the Recents UI.
mPipRecentsOverlayManager.requestFocus(
mTaskStackViewAdapter.getItemCount() > 0);
+ } else {
+ mPipRecentsOverlayManager.clearFocus();
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/tv/animations/DismissAnimationsHolder.java b/packages/SystemUI/src/com/android/systemui/recents/tv/animations/DismissAnimationsHolder.java
index ae8d800..66d8576 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/tv/animations/DismissAnimationsHolder.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/tv/animations/DismissAnimationsHolder.java
@@ -29,7 +29,8 @@
private LinearLayout mDismissArea;
private LinearLayout mInfoField;
private View mThumbnailView;
- private int mCardYDelta;
+ private int mDismissEnterYDelta;
+ private int mDismissStartYDelta;
private long mShortDuration;
private long mLongDuration;
@@ -38,7 +39,8 @@
mDismissArea = (LinearLayout) taskCardView.findViewById(R.id.card_dismiss);
mThumbnailView = taskCardView.findViewById(R.id.card_view_thumbnail);
Resources res = taskCardView.getResources();
- mCardYDelta = res.getDimensionPixelOffset(R.dimen.recents_tv_dismiss_shift_down);
+ mDismissEnterYDelta = res.getDimensionPixelOffset(R.dimen.recents_tv_dismiss_shift_down);
+ mDismissStartYDelta = mDismissEnterYDelta * 2;
mShortDuration = res.getInteger(R.integer.dismiss_short_duration);
mLongDuration = res.getInteger(R.integer.dismiss_long_duration);
}
@@ -52,13 +54,13 @@
mInfoField.animate()
.setDuration(mShortDuration)
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
- .translationYBy(mCardYDelta)
+ .translationY(mDismissEnterYDelta)
.alpha(0.5f);
mThumbnailView.animate()
.setDuration(mShortDuration)
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
- .translationYBy(mCardYDelta)
+ .translationY(mDismissEnterYDelta)
.alpha(0.5f);
}
@@ -71,13 +73,13 @@
mInfoField.animate()
.setDuration(mShortDuration)
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
- .translationYBy(-mCardYDelta)
+ .translationY(0)
.alpha(1.0f);
mThumbnailView.animate()
.setDuration(mShortDuration)
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
- .translationYBy(-mCardYDelta)
+ .translationY(0)
.alpha(1.0f);
}
@@ -90,14 +92,14 @@
mInfoField.animate()
.setDuration(mLongDuration)
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
- .translationYBy(mCardYDelta)
+ .translationY(mDismissStartYDelta)
.alpha(0.0f)
.setListener(listener);
mThumbnailView.animate()
.setDuration(mLongDuration)
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
- .translationYBy(mCardYDelta)
+ .translationY(mDismissStartYDelta)
.alpha(0.0f);
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/tv/animations/HomeRecentsEnterExitAnimationHolder.java b/packages/SystemUI/src/com/android/systemui/recents/tv/animations/HomeRecentsEnterExitAnimationHolder.java
index 497a0a3..92718a3 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/tv/animations/HomeRecentsEnterExitAnimationHolder.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/tv/animations/HomeRecentsEnterExitAnimationHolder.java
@@ -28,6 +28,7 @@
private Context mContext;
private TaskStackHorizontalGridView mGridView;
+ private float mDimAlpha;
private long mDelay;
private int mDuration;
private int mTranslationX;
@@ -36,18 +37,19 @@
TaskStackHorizontalGridView gridView) {
mContext = context;
mGridView = gridView;
+ mDimAlpha = mContext.getResources().getFloat(R.dimen.recents_recents_row_dim_alpha);
mTranslationX = mContext.getResources()
.getDimensionPixelSize(R.dimen.recents_tv_home_recents_shift);
mDelay = mContext.getResources().getInteger(R.integer.recents_home_delay);
mDuration = mContext.getResources().getInteger(R.integer.recents_home_duration);
}
- public void startEnterAnimation() {
+ public void startEnterAnimation(boolean isPipShown) {
for(int i = 0; i < mGridView.getChildCount(); i++) {
TaskCardView view = (TaskCardView) mGridView.getChildAt(i);
view.setTranslationX(-mTranslationX);
view.animate()
- .alpha(1.0f)
+ .alpha(isPipShown ? mDimAlpha : 1.0f)
.translationX(0)
.setDuration(mDuration)
.setStartDelay(mDelay * i)
diff --git a/packages/SystemUI/src/com/android/systemui/recents/tv/animations/RecentsRowFocusAnimationHolder.java b/packages/SystemUI/src/com/android/systemui/recents/tv/animations/RecentsRowFocusAnimationHolder.java
index 28abc34..160835f 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/tv/animations/RecentsRowFocusAnimationHolder.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/tv/animations/RecentsRowFocusAnimationHolder.java
@@ -29,8 +29,6 @@
* Recents row's focus animation with PIP controls.
*/
public class RecentsRowFocusAnimationHolder {
- private static final float DIM_ALPHA = 0.5f;
-
private View mView;
private View mTitleView;
@@ -43,6 +41,7 @@
Resources res = view.getResources();
int duration = res.getInteger(R.integer.recents_tv_pip_focus_anim_duration);
+ float dimAlpha = res.getFloat(R.dimen.recents_recents_row_dim_alpha);
mFocusGainAnimatorSet = new AnimatorSet();
mFocusGainAnimatorSet.playTogether(
@@ -53,7 +52,7 @@
mFocusLoseAnimatorSet = new AnimatorSet();
mFocusLoseAnimatorSet.playTogether(
- ObjectAnimator.ofFloat(mView, "alpha", DIM_ALPHA),
+ ObjectAnimator.ofFloat(mView, "alpha", dimAlpha),
ObjectAnimator.ofFloat(mTitleView, "alpha", 0f));
mFocusLoseAnimatorSet.setDuration(duration);
mFocusLoseAnimatorSet.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/tv/views/RecentsTvView.java b/packages/SystemUI/src/com/android/systemui/recents/tv/views/RecentsTvView.java
index 594f6bc..4058c62 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/tv/views/RecentsTvView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/tv/views/RecentsTvView.java
@@ -112,7 +112,7 @@
if (mTaskStackHorizontalView != null) {
Task task = mTaskStackHorizontalView.getFocusedTask();
if (task != null) {
- launchTaskFomRecents(task);
+ launchTaskFomRecents(task, true);
return true;
}
}
@@ -120,12 +120,12 @@
}
/** Launches the task that recents was launched from if possible */
- public boolean launchPreviousTask() {
+ public boolean launchPreviousTask(boolean animate) {
if (mTaskStackHorizontalView != null) {
TaskStack stack = mTaskStackHorizontalView.getStack();
Task task = stack.getLaunchTarget();
if (task != null) {
- launchTaskFomRecents(task);
+ launchTaskFomRecents(task, animate);
return true;
}
}
@@ -137,18 +137,25 @@
* attempt to scroll to focus the task before launching.
* @param task
*/
- private void launchTaskFomRecents(final Task task) {
- if(task != mTaskStackHorizontalView.getFocusedTask()) {
- if(mScrollListener != null) {
+ private void launchTaskFomRecents(final Task task, boolean animate) {
+ if (!animate) {
+ SystemServicesProxy ssp = Recents.getSystemServices();
+ ssp.startActivityFromRecents(getContext(), task.key, task.title, null);
+ return;
+ }
+ mTaskStackHorizontalView.requestFocus();
+ Task focusedTask = mTaskStackHorizontalView.getFocusedTask();
+ if (focusedTask != null && task != focusedTask) {
+ if (mScrollListener != null) {
mTaskStackHorizontalView.removeOnScrollListener(mScrollListener);
}
mScrollListener = new OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
- if(newState == RecyclerView.SCROLL_STATE_IDLE) {
+ if (newState == RecyclerView.SCROLL_STATE_IDLE) {
TaskCardView cardView = mTaskStackHorizontalView.getChildViewForTask(task);
- if(cardView != null) {
+ if (cardView != null) {
mTransitionHelper.launchTaskFromRecents(mStack, task,
mTaskStackHorizontalView, cardView, null, INVALID_STACK_ID);
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/tv/pip/PipRecentsOverlayManager.java b/packages/SystemUI/src/com/android/systemui/tv/pip/PipRecentsOverlayManager.java
index 8567625..d75561b 100644
--- a/packages/SystemUI/src/com/android/systemui/tv/pip/PipRecentsOverlayManager.java
+++ b/packages/SystemUI/src/com/android/systemui/tv/pip/PipRecentsOverlayManager.java
@@ -150,10 +150,14 @@
* is focused.
* This should be called only by {@link com.android.systemui.recents.tv.RecentsTvActivity}.
*/
- private void clearFocus() {
+ public void clearFocus() {
if (!mIsRecentsShown || !mIsPipFocusedInRecent) {
return;
}
+ if (!mRecentsView.hasFocus()) {
+ // Let mRecentsView's focus listener handle clearFocus().
+ mRecentsView.requestFocus();
+ }
mIsPipFocusedInRecent = false;
mPipManager.resizePinnedStack(STATE_PIP_RECENTS);
mWindowManager.updateViewLayout(mOverlayView, mPipRecentsControlsViewLayoutParams);
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 04a63a1..9703d13 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -628,13 +628,16 @@
public Bundle result = null;
public AssistStructure structure = null;
public AssistContent content = null;
+ public Bundle receiverExtras;
+
public PendingAssistExtras(ActivityRecord _activity, Bundle _extras, Intent _intent,
- String _hint, IResultReceiver _receiver, int _userHandle) {
+ String _hint, IResultReceiver _receiver, Bundle _receiverExtras, int _userHandle) {
activity = _activity;
extras = _extras;
intent = _intent;
hint = _hint;
receiver = _receiver;
+ receiverExtras = _receiverExtras;
userHandle = _userHandle;
}
@Override
@@ -11806,7 +11809,7 @@
@Override
public Bundle getAssistContextExtras(int requestType) {
PendingAssistExtras pae = enqueueAssistContext(requestType, null, null, null,
- null, UserHandle.getCallingUserId(), null, PENDING_ASSIST_EXTRAS_TIMEOUT);
+ null, null, true, UserHandle.getCallingUserId(), null, PENDING_ASSIST_EXTRAS_TIMEOUT);
if (pae == null) {
return null;
}
@@ -11870,14 +11873,17 @@
@Override
public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
- IBinder activityToken) {
- return enqueueAssistContext(requestType, null, null, receiver, activityToken,
- UserHandle.getCallingUserId(), null, PENDING_ASSIST_EXTRAS_LONG_TIMEOUT) != null;
+ Bundle receiverExtras,
+ IBinder activityToken, boolean focused) {
+ return enqueueAssistContext(requestType, null, null, receiver, receiverExtras,
+ activityToken, focused,
+ UserHandle.getCallingUserId(), null, PENDING_ASSIST_EXTRAS_LONG_TIMEOUT)
+ != null;
}
private PendingAssistExtras enqueueAssistContext(int requestType, Intent intent, String hint,
- IResultReceiver receiver, IBinder activityToken, int userHandle, Bundle args,
- long timeout) {
+ IResultReceiver receiver, Bundle receiverExtras, IBinder activityToken, boolean focused,
+ int userHandle, Bundle args, long timeout) {
enforceCallingPermission(android.Manifest.permission.GET_TOP_ACTIVITY_INFO,
"enqueueAssistContext()");
synchronized (this) {
@@ -11890,14 +11896,24 @@
Slog.w(TAG, "getAssistContextExtras failed: no process for " + activity);
return null;
}
- if (activityToken != null) {
- ActivityRecord caller = ActivityRecord.forTokenLocked(activityToken);
- if (activity != caller) {
- Slog.w(TAG, "enqueueAssistContext failed: caller " + caller
- + " is not current top " + activity);
+ if (focused) {
+ if (activityToken != null) {
+ ActivityRecord caller = ActivityRecord.forTokenLocked(activityToken);
+ if (activity != caller) {
+ Slog.w(TAG, "enqueueAssistContext failed: caller " + caller
+ + " is not current top " + activity);
+ return null;
+ }
+ }
+ } else {
+ activity = ActivityRecord.forTokenLocked(activityToken);
+ if (activity == null) {
+ Slog.w(TAG, "enqueueAssistContext failed: activity for token=" + activityToken
+ + " couldn't be found");
return null;
}
}
+
PendingAssistExtras pae;
Bundle extras = new Bundle();
if (args != null) {
@@ -11905,7 +11921,8 @@
}
extras.putString(Intent.EXTRA_ASSIST_PACKAGE, activity.packageName);
extras.putInt(Intent.EXTRA_ASSIST_UID, activity.app.uid);
- pae = new PendingAssistExtras(activity, extras, intent, hint, receiver, userHandle);
+ pae = new PendingAssistExtras(activity, extras, intent, hint, receiver, receiverExtras,
+ userHandle);
try {
activity.app.thread.requestAssistContextExtras(activity.appToken, pae,
requestType);
@@ -11975,9 +11992,11 @@
if ((sendReceiver=pae.receiver) != null) {
// Caller wants result sent back to them.
sendBundle = new Bundle();
- sendBundle.putBundle("data", pae.extras);
- sendBundle.putParcelable("structure", pae.structure);
- sendBundle.putParcelable("content", pae.content);
+ sendBundle.putBundle(VoiceInteractionSession.KEY_DATA, pae.extras);
+ sendBundle.putParcelable(VoiceInteractionSession.KEY_STRUCTURE, pae.structure);
+ sendBundle.putParcelable(VoiceInteractionSession.KEY_CONTENT, pae.content);
+ sendBundle.putBundle(VoiceInteractionSession.KEY_RECEIVER_EXTRAS,
+ pae.receiverExtras);
}
}
if (sendReceiver != null) {
@@ -12007,8 +12026,8 @@
public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
Bundle args) {
- return enqueueAssistContext(requestType, intent, hint, null, null, userHandle, args,
- PENDING_ASSIST_EXTRAS_TIMEOUT) != null;
+ return enqueueAssistContext(requestType, intent, hint, null, null, null, true,
+ userHandle, args, PENDING_ASSIST_EXTRAS_TIMEOUT) != null;
}
public void registerProcessObserver(IProcessObserver observer) {
@@ -20962,6 +20981,13 @@
mStackSupervisor.notifyAppTransitionDone();
}
}
+
+ @Override
+ public List<IBinder> getTopVisibleActivities() {
+ synchronized (ActivityManagerService.this) {
+ return mStackSupervisor.getTopVisibleActivities();
+ }
+ }
}
private final class SleepTokenImpl extends SleepToken {
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 598d9ff..ab3a0b3 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -98,6 +98,7 @@
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;
@@ -4282,4 +4283,31 @@
}
return result;
}
+
+ /**
+ * @return a list of activities which are the top ones in each visible stack. The first
+ * entry will be the focused activity.
+ */
+ public List<IBinder> getTopVisibleActivities() {
+ final ActivityDisplay display = mActivityDisplays.get(Display.DEFAULT_DISPLAY);
+ if (display == null) {
+ return Collections.EMPTY_LIST;
+ }
+ ArrayList<IBinder> topActivityTokens = new ArrayList<>();
+ final ArrayList<ActivityStack> stacks = display.mStacks;
+ for (int i = stacks.size() - 1; i >= 0; i--) {
+ ActivityStack stack = stacks.get(i);
+ if (stack.getStackVisibilityLocked(null) == ActivityStack.STACK_VISIBLE) {
+ ActivityRecord top = stack.topActivity();
+ if (top != null) {
+ if (stack == mFocusedStack) {
+ topActivityTokens.add(0, top.appToken);
+ } else {
+ topActivityTokens.add(top.appToken);
+ }
+ }
+ }
+ }
+ return topActivityTokens;
+ }
}
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerShellCommand.java b/services/core/java/com/android/server/net/NetworkPolicyManagerShellCommand.java
index d339f69..5e68f8e 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerShellCommand.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerShellCommand.java
@@ -329,6 +329,7 @@
final String ssid = removeDoubleQuotes(config.SSID);
if (id.equals(ssid)) {
final NetworkPolicy policy = newPolicy(ssid);
+ policy.metered = true;
Log.i(TAG, "Creating new policy for " + ssid + ": " + policy);
final NetworkPolicy[] newPolicies = new NetworkPolicy[policies.length + 1];
System.arraycopy(policies, 0, newPolicies, 0, policies.length);
diff --git a/services/core/java/com/android/server/webkit/SystemImpl.java b/services/core/java/com/android/server/webkit/SystemImpl.java
index 876bb20..361f0d4 100644
--- a/services/core/java/com/android/server/webkit/SystemImpl.java
+++ b/services/core/java/com/android/server/webkit/SystemImpl.java
@@ -59,13 +59,19 @@
private static final String TAG_AVAILABILITY = "availableByDefault";
private static final String TAG_SIGNATURE = "signature";
private static final String TAG_FALLBACK = "isFallback";
+ private final WebViewProviderInfo[] mWebViewProviderPackages;
- /**
- * Returns all packages declared in the framework resources as potential WebView providers.
- * @hide
- * */
- @Override
- public WebViewProviderInfo[] getWebViewPackages() {
+ // Initialization-on-demand holder idiom for getting the WebView provider packages once and
+ // for all in a thread-safe manner.
+ private static class LazyHolder {
+ private static final SystemImpl INSTANCE = new SystemImpl();
+ }
+
+ public static SystemImpl getInstance() {
+ return LazyHolder.INSTANCE;
+ }
+
+ private SystemImpl() {
int numFallbackPackages = 0;
int numAvailableByDefaultPackages = 0;
int numAvByDefaultAndNotFallback = 0;
@@ -135,7 +141,16 @@
throw new AndroidRuntimeException("There must be at least one WebView package "
+ "that is available by default and not a fallback");
}
- return webViewProviders.toArray(new WebViewProviderInfo[webViewProviders.size()]);
+ mWebViewProviderPackages =
+ webViewProviders.toArray(new WebViewProviderInfo[webViewProviders.size()]);
+ }
+ /**
+ * Returns all packages declared in the framework resources as potential WebView providers.
+ * @hide
+ * */
+ @Override
+ public WebViewProviderInfo[] getWebViewPackages() {
+ return mWebViewProviderPackages;
}
public int getFactoryPackageVersion(String packageName) throws NameNotFoundException {
diff --git a/services/core/java/com/android/server/webkit/WebViewUpdateService.java b/services/core/java/com/android/server/webkit/WebViewUpdateService.java
index bbb4951..9b971e0 100644
--- a/services/core/java/com/android/server/webkit/WebViewUpdateService.java
+++ b/services/core/java/com/android/server/webkit/WebViewUpdateService.java
@@ -55,7 +55,7 @@
public WebViewUpdateService(Context context) {
super(context);
- mImpl = new WebViewUpdateServiceImpl(context, new SystemImpl());
+ mImpl = new WebViewUpdateServiceImpl(context, SystemImpl.getInstance());
}
@Override
diff --git a/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl.java b/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl.java
index 7bd1f63..d90d922 100644
--- a/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl.java
+++ b/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl.java
@@ -404,7 +404,7 @@
}
- private class ProviderAndPackageInfo {
+ private static class ProviderAndPackageInfo {
public final WebViewProviderInfo provider;
public final PackageInfo packageInfo;
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
index 1544723..1e9db18 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
@@ -17,6 +17,7 @@
package com.android.server.voiceinteraction;
import android.app.ActivityManager;
+import android.app.ActivityManagerInternal;
import android.app.ActivityManagerNative;
import android.app.IActivityManager;
import android.content.BroadcastReceiver;
@@ -42,9 +43,11 @@
import com.android.internal.app.IVoiceInteractionSessionShowCallback;
import com.android.internal.app.IVoiceInteractor;
+import com.android.server.LocalServices;
import java.io.FileDescriptor;
import java.io.PrintWriter;
+import java.util.List;
class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConnection.Callback {
final static String TAG = "VoiceInteractionServiceManager";
@@ -148,8 +151,14 @@
mActiveSession = new VoiceInteractionSessionConnection(mLock, mSessionComponentName,
mUser, mContext, this, mInfo.getServiceInfo().applicationInfo.uid, mHandler);
}
+ List<IBinder> activityTokens = null;
+ if (activityToken == null) {
+ // Let's get top activities from all visible stacks
+ activityTokens = LocalServices.getService(ActivityManagerInternal.class)
+ .getTopVisibleActivities();
+ }
return mActiveSession.showLocked(args, flags, mDisabledShowContext, showCallback,
- activityToken);
+ activityToken, activityTokens);
}
public boolean hideSessionLocked() {
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
index e04f312..0922a12 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
@@ -45,6 +45,7 @@
import android.util.Slog;
import android.view.IWindowManager;
import android.view.WindowManager;
+
import com.android.internal.app.IAssistScreenshotReceiver;
import com.android.internal.app.IVoiceInteractionSessionShowCallback;
import com.android.internal.app.IVoiceInteractor;
@@ -55,10 +56,15 @@
import java.io.PrintWriter;
import java.util.ArrayList;
+import java.util.List;
final class VoiceInteractionSessionConnection implements ServiceConnection {
+
final static String TAG = "VoiceInteractionServiceManager";
+ private static final String KEY_RECEIVER_EXTRA_COUNT = "count";
+ private static final String KEY_RECEIVER_EXTRA_INDEX = "index";
+
final IBinder mToken = new Binder();
final Object mLock;
final ComponentName mSessionComponentName;
@@ -82,11 +88,27 @@
IVoiceInteractionSession mSession;
IVoiceInteractor mInteractor;
boolean mHaveAssistData;
- Bundle mAssistData;
+ int mPendingAssistDataCount;
+ ArrayList<AssistDataForActivity> mAssistData = new ArrayList<>();
boolean mHaveScreenshot;
Bitmap mScreenshot;
ArrayList<IVoiceInteractionSessionShowCallback> mPendingShowCallbacks = new ArrayList<>();
+ static class AssistDataForActivity {
+ int activityIndex;
+ int activityCount;
+ Bundle data;
+
+ public AssistDataForActivity(Bundle data) {
+ this.data = data;
+ Bundle receiverExtras = data.getBundle(VoiceInteractionSession.KEY_RECEIVER_EXTRAS);
+ if (receiverExtras != null) {
+ activityIndex = receiverExtras.getInt(KEY_RECEIVER_EXTRA_INDEX);
+ activityCount = receiverExtras.getInt(KEY_RECEIVER_EXTRA_COUNT);
+ }
+ }
+ }
+
IVoiceInteractionSessionShowCallback mShowCallback =
new IVoiceInteractionSessionShowCallback.Stub() {
@Override
@@ -125,7 +147,7 @@
synchronized (mLock) {
if (mShown) {
mHaveAssistData = true;
- mAssistData = resultData;
+ mAssistData.add(new AssistDataForActivity(resultData));
deliverSessionDataLocked();
}
}
@@ -198,7 +220,8 @@
}
public boolean showLocked(Bundle args, int flags, int disabledContext,
- IVoiceInteractionSessionShowCallback showCallback, IBinder activityToken) {
+ IVoiceInteractionSessionShowCallback showCallback, IBinder activityToken,
+ List<IBinder> topActivities) {
if (mBound) {
if (!mFullyBound) {
mFullyBound = mContext.bindServiceAsUser(mBindIntent, mFullConnection,
@@ -220,30 +243,41 @@
mShowArgs = args;
mShowFlags = flags;
mHaveAssistData = false;
+ mPendingAssistDataCount = 0;
boolean needDisclosure = false;
if ((flags&VoiceInteractionSession.SHOW_WITH_ASSIST) != 0) {
if (mAppOps.noteOpNoThrow(AppOpsManager.OP_ASSIST_STRUCTURE, mCallingUid,
mSessionComponentName.getPackageName()) == AppOpsManager.MODE_ALLOWED
&& structureEnabled) {
- try {
- MetricsLogger.count(mContext, "assist_with_context", 1);
- if (mAm.requestAssistContextExtras(ActivityManager.ASSIST_CONTEXT_FULL,
- mAssistReceiver, activityToken)) {
- needDisclosure = true;
- } else {
- // Wasn't allowed... given that, let's not do the screenshot either.
- mHaveAssistData = true;
- mAssistData = null;
- screenshotEnabled = false;
+ mAssistData.clear();
+ final int count = activityToken != null ? 1 : topActivities.size();
+ for (int i = 0; i < count; i++) {
+ IBinder topActivity = count == 1 ? activityToken : topActivities.get(i);
+ try {
+ MetricsLogger.count(mContext, "assist_with_context", 1);
+ Bundle receiverExtras = new Bundle();
+ receiverExtras.putInt(KEY_RECEIVER_EXTRA_INDEX, i);
+ receiverExtras.putInt(KEY_RECEIVER_EXTRA_COUNT, count);
+ if (mAm.requestAssistContextExtras(ActivityManager.ASSIST_CONTEXT_FULL,
+ mAssistReceiver, receiverExtras, topActivity, i == 0)) {
+ needDisclosure = true;
+ mPendingAssistDataCount++;
+ } else if (i == 0) {
+ // Wasn't allowed... given that, let's not do the screenshot either.
+ mHaveAssistData = true;
+ mAssistData.clear();
+ screenshotEnabled = false;
+ break;
+ }
+ } catch (RemoteException e) {
}
- } catch (RemoteException e) {
}
} else {
mHaveAssistData = true;
- mAssistData = null;
+ mAssistData.clear();
}
} else {
- mAssistData = null;
+ mAssistData.clear();
}
mHaveScreenshot = false;
if ((flags&VoiceInteractionSession.SHOW_WITH_SCREENSHOT) != 0) {
@@ -335,41 +369,26 @@
return;
}
if (mHaveAssistData) {
- Bundle assistData;
- AssistStructure structure;
- AssistContent content;
- if (mAssistData != null) {
- assistData = mAssistData.getBundle("data");
- structure = mAssistData.getParcelable("structure");
- content = mAssistData.getParcelable("content");
- int uid = mAssistData.getInt(Intent.EXTRA_ASSIST_UID, -1);
- if (uid >= 0 && content != null) {
- Intent intent = content.getIntent();
- if (intent != null) {
- ClipData data = intent.getClipData();
- if (data != null && Intent.isAccessUriMode(intent.getFlags())) {
- grantClipDataPermissions(data, intent.getFlags(), uid,
- mCallingUid, mSessionComponentName.getPackageName());
- }
- }
- ClipData data = content.getClipData();
- if (data != null) {
- grantClipDataPermissions(data,
- Intent.FLAG_GRANT_READ_URI_PERMISSION,
- uid, mCallingUid, mSessionComponentName.getPackageName());
- }
+ AssistDataForActivity assistData;
+ while (!mAssistData.isEmpty()) {
+ if (mPendingAssistDataCount <= 0) {
+ Slog.e(TAG, "mPendingAssistDataCount is " + mPendingAssistDataCount);
}
- } else {
- assistData = null;
- structure = null;
- content = null;
+ mPendingAssistDataCount--;
+ assistData = mAssistData.remove(0);
+ if (assistData.data == null) {
+ try {
+ mSession.handleAssist(null, null, null, assistData.activityIndex,
+ assistData.activityCount);
+ } catch (RemoteException e) {
+ }
+ } else {
+ deliverSessionDataLocked(assistData);
+ }
}
- try {
- mSession.handleAssist(assistData, structure, content);
- } catch (RemoteException e) {
- }
- mAssistData = null;
- mHaveAssistData = false;
+ if (mPendingAssistDataCount <= 0) {
+ mHaveAssistData = false;
+ } // else, more to come
}
if (mHaveScreenshot) {
try {
@@ -381,6 +400,37 @@
}
}
+ private void deliverSessionDataLocked(AssistDataForActivity assistDataForActivity) {
+ Bundle assistData = assistDataForActivity.data.getBundle(
+ VoiceInteractionSession.KEY_DATA);
+ AssistStructure structure = assistDataForActivity.data.getParcelable(
+ VoiceInteractionSession.KEY_STRUCTURE);
+ AssistContent content = assistDataForActivity.data.getParcelable(
+ VoiceInteractionSession.KEY_CONTENT);
+ int uid = assistDataForActivity.data.getInt(Intent.EXTRA_ASSIST_UID, -1);
+ if (uid >= 0 && content != null) {
+ Intent intent = content.getIntent();
+ if (intent != null) {
+ ClipData data = intent.getClipData();
+ if (data != null && Intent.isAccessUriMode(intent.getFlags())) {
+ grantClipDataPermissions(data, intent.getFlags(), uid,
+ mCallingUid, mSessionComponentName.getPackageName());
+ }
+ }
+ ClipData data = content.getClipData();
+ if (data != null) {
+ grantClipDataPermissions(data,
+ Intent.FLAG_GRANT_READ_URI_PERMISSION,
+ uid, mCallingUid, mSessionComponentName.getPackageName());
+ }
+ }
+ try {
+ mSession.handleAssist(assistData, structure, content,
+ assistDataForActivity.activityIndex, assistDataForActivity.activityCount);
+ } catch (RemoteException e) {
+ }
+ }
+
public boolean hideLocked() {
if (mBound) {
if (mShown) {
@@ -388,7 +438,7 @@
mShowArgs = null;
mShowFlags = 0;
mHaveAssistData = false;
- mAssistData = null;
+ mAssistData.clear();
if (mSession != null) {
try {
mSession.hide();
diff --git a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java
index 450334c..5767f11 100644
--- a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java
+++ b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java
@@ -194,6 +194,18 @@
}
@Override
+ public void onHandleAssistSecondary(final Bundle data, final AssistStructure structure,
+ final AssistContent content, int index, int count) {
+ Log.i(TAG, "Got secondary activity assist data " + index + " of " + count);
+ Log.i(TAG, "Showing assist structure after a few seconds...");
+ mContentView.postDelayed(new Runnable() {
+ public void run() {
+ onHandleAssist(data, structure, content);
+ }
+ }, 2000 * index);
+ }
+
+ @Override
public void onHandleScreenshot(Bitmap screenshot) {
if (screenshot != null) {
mScreenshot.setImageBitmap(screenshot);
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java
index 308488a..e0d8249 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java
@@ -24,6 +24,7 @@
import com.android.ide.common.rendering.api.ViewInfo;
import com.android.layoutlib.bridge.impl.RenderSessionImpl;
import com.android.tools.layoutlib.java.System_Delegate;
+import com.android.util.PropertiesMap;
import android.view.View;
import android.view.ViewGroup;
@@ -70,6 +71,11 @@
}
@Override
+ public Map<Object, PropertiesMap> getDefaultProperties() {
+ return mSession.getDefaultProperties();
+ }
+
+ @Override
public Result render(long timeout, boolean forceMeasure) {
try {
Bridge.prepareThread();
@@ -196,10 +202,6 @@
}
}
- public RenderSessionImpl getSessionImpl() {
- return mSession;
- }
-
/*package*/ BridgeRenderSession(RenderSessionImpl scene, Result lastResult) {
mSession = scene;
if (scene != null) {
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
index fd95bd5..80e230c 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
@@ -27,12 +27,13 @@
import com.android.ide.common.rendering.api.StyleResourceValue;
import com.android.layoutlib.bridge.Bridge;
import com.android.layoutlib.bridge.BridgeConstants;
-import com.android.layoutlib.bridge.android.PropertiesMap.Property;
import com.android.layoutlib.bridge.android.view.WindowManagerImpl;
import com.android.layoutlib.bridge.impl.ParserFactory;
import com.android.layoutlib.bridge.impl.Stack;
import com.android.resources.ResourceType;
import com.android.util.Pair;
+import com.android.util.PropertiesMap;
+import com.android.util.PropertiesMap.Property;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -153,7 +154,6 @@
private IBinder mBinder;
private PackageManager mPackageManager;
-
/**
* Some applications that target both pre API 17 and post API 17, set the newer attrs to
* reference the older ones. For example, android:paddingStart will resolve to
@@ -276,8 +276,8 @@
return mRenderResources;
}
- public PropertiesMap getDefaultPropMap(Object key) {
- return mDefaultPropMaps.get(key);
+ public Map<Object, PropertiesMap> getDefaultProperties() {
+ return mDefaultPropMaps;
}
public Configuration getConfiguration() {
@@ -1862,7 +1862,6 @@
return false;
}
-
/**
* The cached value depends on
* <ol>
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/PropertiesMap.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/PropertiesMap.java
deleted file mode 100644
index a38d579..0000000
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/PropertiesMap.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.layoutlib.bridge.android;
-
-import com.android.layoutlib.bridge.android.PropertiesMap.Property;
-
-import java.util.HashMap;
-
-/**
- * An alias used for the value in {@link BridgeContext#mDefaultPropMaps}
- */
-public class PropertiesMap extends HashMap<String, Property> {
-
- public static class Property {
- public final String resource;
- public final String value;
-
- public Property(String resource, String value) {
- this.resource = resource;
- this.value = value;
- }
- }
-}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java
index 2d38831..0c53753 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java
@@ -286,7 +286,7 @@
return mParams;
}
- public BridgeContext getContext() {
+ protected BridgeContext getContext() {
return mContext;
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
index 11fabc6..3ef568c 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
@@ -48,6 +48,7 @@
import com.android.resources.ResourceType;
import com.android.tools.layoutlib.java.System_Delegate;
import com.android.util.Pair;
+import com.android.util.PropertiesMap;
import android.animation.AnimationThread;
import android.animation.Animator;
@@ -1415,6 +1416,10 @@
return mSystemViewInfoList;
}
+ public Map<Object, PropertiesMap> getDefaultProperties() {
+ return getContext().getDefaultProperties();
+ }
+
public void setScene(RenderSession session) {
mScene = session;
}