summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2015-06-04 16:56:39 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-04 16:56:52 +0000
commitb0a5e78fc06aeb67ac1f55832c9ceef5f92a0807 (patch)
tree310f16ba5e22eec96820b6d8f0945d789a3d7ca6 /core/java/android
parent52999685178656caba37fa0e9055ac26d707bdce (diff)
parent69c6adc96eecfde74ceb83cf9177428dc08b6067 (diff)
Merge "More API changes." into mnc-dev
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/Activity.java1
-rw-r--r--core/java/android/app/ActivityManagerNative.java2
-rw-r--r--core/java/android/app/ActivityThread.java2
-rw-r--r--core/java/android/app/AssistContent.java36
-rw-r--r--core/java/android/app/AssistStructure.java63
-rw-r--r--core/java/android/app/IActivityManager.java2
-rw-r--r--core/java/android/app/assist/AssistContent.aidl (renamed from core/java/android/app/AssistContent.aidl)2
-rw-r--r--core/java/android/app/assist/AssistContent.java44
-rw-r--r--core/java/android/app/assist/AssistStructure.aidl (renamed from core/java/android/app/AssistStructure.aidl)2
-rw-r--r--core/java/android/app/assist/AssistStructure.java56
-rw-r--r--core/java/android/service/voice/IVoiceInteractionSession.aidl4
-rw-r--r--core/java/android/service/voice/VoiceInteractionSession.java43
-rw-r--r--core/java/android/view/ViewStructure.java1
13 files changed, 177 insertions, 81 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 073fefcb7940..90567c7d819f 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -38,6 +38,7 @@ import com.android.internal.app.ToolbarActionBar;
import android.annotation.SystemApi;
import android.app.admin.DevicePolicyManager;
+import android.app.assist.AssistContent;
import android.content.ComponentCallbacks2;
import android.content.ComponentName;
import android.content.ContentResolver;
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index e4def1e0ab81..b6cec60b8416 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -17,6 +17,8 @@
package android.app;
import android.app.ActivityManager.StackInfo;
+import android.app.assist.AssistContent;
+import android.app.assist.AssistStructure;
import android.content.ComponentName;
import android.content.IIntentReceiver;
import android.content.IIntentSender;
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 2a98b6c74585..3224d4142229 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -16,6 +16,8 @@
package android.app;
+import android.app.assist.AssistContent;
+import android.app.assist.AssistStructure;
import android.app.backup.BackupAgent;
import android.content.BroadcastReceiver;
import android.content.ComponentCallbacks2;
diff --git a/core/java/android/app/AssistContent.java b/core/java/android/app/AssistContent.java
index f271af10c516..4cb89a81005e 100644
--- a/core/java/android/app/AssistContent.java
+++ b/core/java/android/app/AssistContent.java
@@ -26,9 +26,11 @@ import android.os.Parcelable;
/**
* Holds information about the content an application is viewing, to hand to an
* assistant at the user's request. This is filled in by
- * {@link Activity#onProvideAssistContent Activity.onProvideAssistContent}.
+ * {@link android.app.Activity#onProvideAssistContent Activity.onProvideAssistContent}.
+ * @deprecated use {@link android.app.assist.AssistContent}.
*/
-public class AssistContent implements Parcelable {
+@Deprecated
+public class AssistContent {
private Intent mIntent;
private ClipData mClipData;
private Uri mUri;
@@ -36,16 +38,16 @@ public class AssistContent implements Parcelable {
/**
* @hide
* Key name this data structure is stored in the Bundle generated by
- * {@link Activity#onProvideAssistData}.
+ * {@link android.app.Activity#onProvideAssistData}.
*/
public static final String ASSIST_KEY = "android:assist_content";
/**
* @hide
* Retrieve the framework-generated AssistContent that is stored within
- * the Bundle filled in by {@link Activity#onProvideAssistContent}.
+ * the Bundle filled in by {@link android.app.Activity#onProvideAssistContent}.
*/
- public static AssistContent getAssistContent(Bundle assistBundle) {
+ public static android.app.assist.AssistContent getAssistContent(Bundle assistBundle) {
return assistBundle.getParcelable(ASSIST_KEY);
}
@@ -71,6 +73,7 @@ public class AssistContent implements Parcelable {
/**
* Return the current {@link #setIntent}, which you can modify in-place.
+ * @hide
*/
public Intent getIntent() {
return mIntent;
@@ -116,7 +119,8 @@ public class AssistContent implements Parcelable {
return mUri;
}
- AssistContent(Parcel in) {
+ /** @hide */
+ public AssistContent(Parcel in) {
if (in.readInt() != 0) {
mIntent = Intent.CREATOR.createFromParcel(in);
}
@@ -128,13 +132,8 @@ public class AssistContent implements Parcelable {
}
}
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
+ /** @hide */
+ public void writeToParcelInternal(Parcel dest, int flags) {
if (mIntent != null) {
dest.writeInt(1);
mIntent.writeToParcel(dest, flags);
@@ -154,15 +153,4 @@ public class AssistContent implements Parcelable {
dest.writeInt(0);
}
}
-
- public static final Parcelable.Creator<AssistContent> CREATOR
- = new Parcelable.Creator<AssistContent>() {
- public AssistContent createFromParcel(Parcel in) {
- return new AssistContent(in);
- }
-
- public AssistContent[] newArray(int size) {
- return new AssistContent[size];
- }
- };
}
diff --git a/core/java/android/app/AssistStructure.java b/core/java/android/app/AssistStructure.java
index ca47a5ebcef9..ef7fde4d9946 100644
--- a/core/java/android/app/AssistStructure.java
+++ b/core/java/android/app/AssistStructure.java
@@ -17,9 +17,7 @@
package android.app;
import android.content.ComponentName;
-import android.graphics.Paint;
import android.graphics.Rect;
-import android.graphics.Typeface;
import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder;
@@ -29,7 +27,6 @@ import android.os.PooledStringReader;
import android.os.PooledStringWriter;
import android.os.RemoteException;
import android.os.SystemClock;
-import android.text.TextPaint;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
@@ -42,19 +39,22 @@ import java.util.ArrayList;
/**
* Assist data automatically created by the platform's implementation
- * of {@link Activity#onProvideAssistData}.
+ * of {@link android.app.Activity#onProvideAssistData}.
+ * @deprecated use {@link android.app.assist.AssistStructure}.
*/
-final public class AssistStructure implements Parcelable {
+@Deprecated
+public class AssistStructure {
static final String TAG = "AssistStructure";
/**
* @hide
* Key name this data structure is stored in the Bundle generated by
- * {@link Activity#onProvideAssistData}.
+ * {@link android.app.Activity#onProvideAssistData}.
*/
public static final String ASSIST_KEY = "android:assist_structure";
- boolean mHaveData;
+ /** @hide */
+ public boolean mHaveData;
ComponentName mActivityComponent;
@@ -62,15 +62,18 @@ final public class AssistStructure implements Parcelable {
final ArrayList<ViewNodeBuilder> mPendingAsyncChildren = new ArrayList<>();
- SendChannel mSendChannel;
- IBinder mReceiveChannel;
+ /** @hide */
+ public SendChannel mSendChannel;
+ /** @hide */
+ public IBinder mReceiveChannel;
Rect mTmpRect = new Rect();
static final int TRANSACTION_XFER = Binder.FIRST_CALL_TRANSACTION+1;
static final String DESCRIPTOR = "android.app.AssistStructure";
- final class SendChannel extends Binder {
+ /** @hide */
+ public final class SendChannel extends Binder {
@Override protected boolean onTransact(int code, Parcel data, Parcel reply, int flags)
throws RemoteException {
if (code == TRANSACTION_XFER) {
@@ -702,7 +705,8 @@ final public class AssistStructure implements Parcelable {
}
}
- AssistStructure(Activity activity) {
+ /** @hide */
+ public AssistStructure(Activity activity) {
mHaveData = true;
mActivityComponent = activity.getComponentName();
ArrayList<ViewRootImpl> views = WindowManagerGlobal.getInstance().getRootViews(
@@ -713,12 +717,13 @@ final public class AssistStructure implements Parcelable {
}
}
- AssistStructure() {
+ public AssistStructure() {
mHaveData = true;
mActivityComponent = null;
}
- AssistStructure(Parcel in) {
+ /** @hide */
+ public AssistStructure(Parcel in) {
mReceiveChannel = in.readStrongBinder();
}
@@ -792,7 +797,7 @@ final public class AssistStructure implements Parcelable {
* Retrieve the framework-generated AssistStructure that is stored within
* the Bundle filled in by {@link Activity#onProvideAssistData}.
*/
- public static AssistStructure getAssistStructure(Bundle assistBundle) {
+ public static android.app.assist.AssistStructure getAssistStructure(Bundle assistBundle) {
return assistBundle.getParcelable(ASSIST_KEY);
}
@@ -812,16 +817,13 @@ final public class AssistStructure implements Parcelable {
/**
* Return one of the windows in the assist data.
* @param index Which window to retrieve, may be 0 to {@link #getWindowNodeCount()}-1.
+ * @hide
*/
public WindowNode getWindowNodeAt(int index) {
ensureData();
return mWindowNodes.get(index);
}
- public int describeContents() {
- return 0;
- }
-
/** @hide */
public void ensureData() {
if (mHaveData) {
@@ -880,29 +882,4 @@ final public class AssistStructure implements Parcelable {
}
//dump();
}
-
- public void writeToParcel(Parcel out, int flags) {
- if (mHaveData) {
- // This object holds its data. We want to write a send channel that the
- // other side can use to retrieve that data.
- if (mSendChannel == null) {
- mSendChannel = new SendChannel();
- }
- out.writeStrongBinder(mSendChannel);
- } else {
- // This object doesn't hold its data, so just propagate along its receive channel.
- out.writeStrongBinder(mReceiveChannel);
- }
- }
-
- public static final Parcelable.Creator<AssistStructure> CREATOR
- = new Parcelable.Creator<AssistStructure>() {
- public AssistStructure createFromParcel(Parcel in) {
- return new AssistStructure(in);
- }
-
- public AssistStructure[] newArray(int size) {
- return new AssistStructure[size];
- }
- };
}
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index 0a425aea5bbb..249cdb2daf38 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -19,6 +19,8 @@ package android.app;
import android.app.ActivityManager.RunningTaskInfo;
import android.app.ActivityManager.RunningServiceInfo;
import android.app.ActivityManager.StackInfo;
+import android.app.assist.AssistContent;
+import android.app.assist.AssistStructure;
import android.content.ComponentName;
import android.content.ContentProviderNative;
import android.content.IContentProvider;
diff --git a/core/java/android/app/AssistContent.aidl b/core/java/android/app/assist/AssistContent.aidl
index a6321bf10d5e..24379bbd590f 100644
--- a/core/java/android/app/AssistContent.aidl
+++ b/core/java/android/app/assist/AssistContent.aidl
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-package android.app;
+package android.app.assist;
parcelable AssistContent;
diff --git a/core/java/android/app/assist/AssistContent.java b/core/java/android/app/assist/AssistContent.java
new file mode 100644
index 000000000000..c7e7330efa87
--- /dev/null
+++ b/core/java/android/app/assist/AssistContent.java
@@ -0,0 +1,44 @@
+package android.app.assist;
+
+import android.content.Intent;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * New home for AssistContent.
+ */
+public final class AssistContent extends android.app.AssistContent implements Parcelable {
+
+ /** @hide */
+ public AssistContent() {
+ }
+
+ public AssistContent(Parcel in) {
+ super(in);
+ }
+
+ public Intent getIntent() {
+ return super.getIntent();
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ writeToParcelInternal(dest, flags);
+ }
+
+ public static final Parcelable.Creator<AssistContent> CREATOR
+ = new Parcelable.Creator<AssistContent>() {
+ public AssistContent createFromParcel(Parcel in) {
+ return new AssistContent(in);
+ }
+
+ public AssistContent[] newArray(int size) {
+ return new AssistContent[size];
+ }
+ };
+}
diff --git a/core/java/android/app/AssistStructure.aidl b/core/java/android/app/assist/AssistStructure.aidl
index 07fb245338b0..ae0a34c92a0e 100644
--- a/core/java/android/app/AssistStructure.aidl
+++ b/core/java/android/app/assist/AssistStructure.aidl
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-package android.app;
+package android.app.assist;
parcelable AssistStructure;
diff --git a/core/java/android/app/assist/AssistStructure.java b/core/java/android/app/assist/AssistStructure.java
new file mode 100644
index 000000000000..1677e9576b6e
--- /dev/null
+++ b/core/java/android/app/assist/AssistStructure.java
@@ -0,0 +1,56 @@
+package android.app.assist;
+
+import android.app.Activity;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * New home for AssistStructure.
+ */
+public final class AssistStructure extends android.app.AssistStructure implements Parcelable {
+
+ public AssistStructure() {
+ }
+
+ /** @hide */
+ public AssistStructure(Activity activity) {
+ super(activity);
+ }
+
+ AssistStructure(Parcel in) {
+ super(in);
+ }
+
+ public WindowNode getWindowNodeAt(int index) {
+ return super.getWindowNodeAt(index);
+ }
+
+ public int describeContents() {
+ return 0;
+ }
+
+ public void writeToParcel(Parcel out, int flags) {
+ if (mHaveData) {
+ // This object holds its data. We want to write a send channel that the
+ // other side can use to retrieve that data.
+ if (mSendChannel == null) {
+ mSendChannel = new SendChannel();
+ }
+ out.writeStrongBinder(mSendChannel);
+ } else {
+ // This object doesn't hold its data, so just propagate along its receive channel.
+ out.writeStrongBinder(mReceiveChannel);
+ }
+ }
+
+ public static final Parcelable.Creator<AssistStructure> CREATOR
+ = new Parcelable.Creator<AssistStructure>() {
+ public AssistStructure createFromParcel(Parcel in) {
+ return new AssistStructure(in);
+ }
+
+ public AssistStructure[] newArray(int size) {
+ return new AssistStructure[size];
+ }
+ };
+}
diff --git a/core/java/android/service/voice/IVoiceInteractionSession.aidl b/core/java/android/service/voice/IVoiceInteractionSession.aidl
index 894edac2c3cb..8fe84e16bae3 100644
--- a/core/java/android/service/voice/IVoiceInteractionSession.aidl
+++ b/core/java/android/service/voice/IVoiceInteractionSession.aidl
@@ -16,8 +16,8 @@
package android.service.voice;
-import android.app.AssistContent;
-import android.app.AssistStructure;
+import android.app.assist.AssistContent;
+import android.app.assist.AssistStructure;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
diff --git a/core/java/android/service/voice/VoiceInteractionSession.java b/core/java/android/service/voice/VoiceInteractionSession.java
index 48ad5a887c35..33fef6214d6f 100644
--- a/core/java/android/service/voice/VoiceInteractionSession.java
+++ b/core/java/android/service/voice/VoiceInteractionSession.java
@@ -16,11 +16,11 @@
package android.service.voice;
-import android.app.AssistContent;
-import android.app.AssistStructure;
import android.app.Dialog;
import android.app.Instrumentation;
import android.app.VoiceInteractor;
+import android.app.assist.AssistContent;
+import android.app.assist.AssistStructure;
import android.content.ComponentCallbacks2;
import android.content.Context;
import android.content.Intent;
@@ -386,7 +386,7 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
}
/**
- * ASk the app to cancel this current request.
+ * ASk the app to cancelLocked this current request.
*/
public void cancel() {
try {
@@ -878,14 +878,34 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
show(null, 0);
}
- public void show(Bundle args, int showFlags) {
+ /**
+ * Show the UI for this session. This asks the system to go through the process of showing
+ * your UI, which will eventually culminate in {@link #onShow}. This is similar to calling
+ * {@link VoiceInteractionService#showSession VoiceInteractionService.showSession}.
+ * @param args Arbitrary arguments that will be propagated {@link #onShow}.
+ * @param flags Indicates additional optional behavior that should be performed. May
+ * be {@link VoiceInteractionSession#SHOW_WITH_ASSIST VoiceInteractionSession.SHOW_WITH_ASSIST}
+ * to request that the system generate and deliver assist data on the current foreground
+ * app as part of showing the session UI.
+ */
+ public void show(Bundle args, int flags) {
+ if (mToken == null) {
+ throw new IllegalStateException("Can't call before onCreate()");
+ }
try {
- mSystemService.showSessionFromSession(mToken, null, 0);
+ mSystemService.showSessionFromSession(mToken, args, flags);
} catch (RemoteException e) {
}
}
+ /**
+ * Hide the session's UI, if currently shown. Call this when you are done with your
+ * user interaction.
+ */
public void hide() {
+ if (mToken == null) {
+ throw new IllegalStateException("Can't call before onCreate()");
+ }
try {
mSystemService.hideSessionFromSession(mToken);
} catch (RemoteException e) {
@@ -964,6 +984,9 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
* {@link #startVoiceActivity}.</p>
*/
public void setKeepAwake(boolean keepAwake) {
+ if (mToken == null) {
+ throw new IllegalStateException("Can't call before onCreate()");
+ }
try {
mSystemService.setKeepAwake(mToken, keepAwake);
} catch (RemoteException e) {
@@ -985,7 +1008,9 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
}
/**
- * Finish the session.
+ * Finish the session. This completely destroys the session -- the next time it is shown,
+ * an entirely new one will be created. You do not normally call this function; instead,
+ * use {@link #hide} and allow the system to destroy your session if it needs its RAM.
*/
public void finish() {
if (mToken == null) {
@@ -1114,7 +1139,7 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
* Called when the user presses the back button while focus is in the session UI. Note
* that this will only happen if the session UI has requested input focus in its window;
* otherwise, the back key will go to whatever window has focus and do whatever behavior
- * it normally has there.
+ * it normally has there. The default implementation simply calls {@link #hide}.
*/
public void onBackPressed() {
hide();
@@ -1123,7 +1148,7 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
/**
* Sessions automatically watch for requests that all system UI be closed (such as when
* the user presses HOME), which will appear here. The default implementation always
- * calls {@link #finish}.
+ * calls {@link #hide}.
*/
public void onCloseSystemDialogs() {
hide();
@@ -1287,7 +1312,7 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
}
/**
- * Called when the {@link android.app.VoiceInteractor} has asked to cancel a {@link Request}
+ * Called when the {@link android.app.VoiceInteractor} has asked to cancelLocked a {@link Request}
* that was previously delivered to {@link #onRequestConfirmation},
* {@link #onRequestPickOption}, {@link #onRequestCompleteVoice}, {@link #onRequestAbortVoice},
* or {@link #onRequestCommand}.
diff --git a/core/java/android/view/ViewStructure.java b/core/java/android/view/ViewStructure.java
index 886547ac42e4..e525474bae6c 100644
--- a/core/java/android/view/ViewStructure.java
+++ b/core/java/android/view/ViewStructure.java
@@ -18,7 +18,6 @@ package android.view;
import android.graphics.Rect;
import android.os.Bundle;
-import android.text.TextPaint;
/**
* Container for storing additional per-view data generated by {@link View#onProvideStructure