Loading Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ LOCAL_SRC_FILES += \ core/java/android/app/ISearchManagerCallback.aidl \ core/java/android/app/IServiceConnection.aidl \ core/java/android/app/IThumbnailReceiver.aidl \ core/java/android/app/IThumbnailRetriever.aidl \ core/java/android/app/ITransientNotification.aidl \ core/java/android/app/IUiModeManager.aidl \ core/java/android/app/IWallpaperManager.aidl \ Loading core/java/android/app/ActivityManager.java +65 −2 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import android.util.Log; import com.android.internal.app.IUsageStats; import com.android.internal.os.PkgUsageStats; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; Loading Loading @@ -395,9 +396,71 @@ public class ActivityManager { } /** @hide */ public Bitmap getTaskThumbnail(int id) throws SecurityException { public static class TaskThumbnails implements Parcelable { public Bitmap mainThumbnail; public int numSubThumbbails; /** @hide */ public IThumbnailRetriever retriever; /** @hide Magic for ActivityManagerService. Not marshalled */ public ArrayList<Bitmap> otherThumbnails; public TaskThumbnails() { } public Bitmap getSubThumbnail(int index) { try { return retriever.getThumbnail(index); } catch (RemoteException e) { return null; } } public int describeContents() { return 0; } public void writeToParcel(Parcel dest, int flags) { if (mainThumbnail != null) { dest.writeInt(1); mainThumbnail.writeToParcel(dest, 0); } else { dest.writeInt(0); } dest.writeInt(numSubThumbbails); dest.writeStrongInterface(retriever); } public void readFromParcel(Parcel source) { if (source.readInt() != 0) { mainThumbnail = Bitmap.CREATOR.createFromParcel(source); } else { mainThumbnail = null; } numSubThumbbails = source.readInt(); retriever = IThumbnailRetriever.Stub.asInterface(source.readStrongBinder()); } public static final Creator<TaskThumbnails> CREATOR = new Creator<TaskThumbnails>() { public TaskThumbnails createFromParcel(Parcel source) { return new TaskThumbnails(source); } public TaskThumbnails[] newArray(int size) { return new TaskThumbnails[size]; } }; private TaskThumbnails(Parcel source) { readFromParcel(source); } } /** @hide */ public TaskThumbnails getTaskThumbnails(int id) throws SecurityException { try { return ActivityManagerNative.getDefault().getTaskThumbnail(id); return ActivityManagerNative.getDefault().getTaskThumbnails(id); } catch (RemoteException e) { // System dead, we will be dead too soon! return null; Loading core/java/android/app/ActivityManagerNative.java +6 −6 Original line number Diff line number Diff line Loading @@ -441,10 +441,10 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } case GET_TASK_THUMBNAIL_TRANSACTION: { case GET_TASK_THUMBNAILS_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int id = data.readInt(); Bitmap bm = getTaskThumbnail(id); ActivityManager.TaskThumbnails bm = getTaskThumbnails(id); reply.writeNoException(); if (bm != null) { reply.writeInt(1); Loading Loading @@ -1830,16 +1830,16 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); return list; } public Bitmap getTaskThumbnail(int id) throws RemoteException { public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeInt(id); mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0); mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0); reply.readException(); Bitmap bm = null; ActivityManager.TaskThumbnails bm = null; if (reply.readInt() != 0) { bm = Bitmap.CREATOR.createFromParcel(reply); bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply); } data.recycle(); reply.recycle(); Loading core/java/android/app/IActivityManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ public interface IActivityManager extends IInterface { IThumbnailReceiver receiver) throws RemoteException; public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum, int flags) throws RemoteException; public Bitmap getTaskThumbnail(int taskId) throws RemoteException; public ActivityManager.TaskThumbnails getTaskThumbnails(int taskId) throws RemoteException; public List getServices(int maxNum, int flags) throws RemoteException; public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState() throws RemoteException; Loading Loading @@ -515,7 +515,7 @@ public interface IActivityManager extends IInterface { int FORCE_STOP_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+78; int KILL_PIDS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+79; int GET_SERVICES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+80; int GET_TASK_THUMBNAIL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+81; int GET_TASK_THUMBNAILS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+81; int GET_RUNNING_APP_PROCESSES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+82; int GET_DEVICE_CONFIGURATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+83; int PEEK_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+84; Loading core/java/android/app/IThumbnailRetriever.aidl 0 → 100644 +24 −0 Original line number Diff line number Diff line /* Copyright 2011, 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 android.app; import android.graphics.Bitmap; /** * System private API for retrieving thumbnails */ interface IThumbnailRetriever { Bitmap getThumbnail(int index); } Loading
Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ LOCAL_SRC_FILES += \ core/java/android/app/ISearchManagerCallback.aidl \ core/java/android/app/IServiceConnection.aidl \ core/java/android/app/IThumbnailReceiver.aidl \ core/java/android/app/IThumbnailRetriever.aidl \ core/java/android/app/ITransientNotification.aidl \ core/java/android/app/IUiModeManager.aidl \ core/java/android/app/IWallpaperManager.aidl \ Loading
core/java/android/app/ActivityManager.java +65 −2 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import android.util.Log; import com.android.internal.app.IUsageStats; import com.android.internal.os.PkgUsageStats; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; Loading Loading @@ -395,9 +396,71 @@ public class ActivityManager { } /** @hide */ public Bitmap getTaskThumbnail(int id) throws SecurityException { public static class TaskThumbnails implements Parcelable { public Bitmap mainThumbnail; public int numSubThumbbails; /** @hide */ public IThumbnailRetriever retriever; /** @hide Magic for ActivityManagerService. Not marshalled */ public ArrayList<Bitmap> otherThumbnails; public TaskThumbnails() { } public Bitmap getSubThumbnail(int index) { try { return retriever.getThumbnail(index); } catch (RemoteException e) { return null; } } public int describeContents() { return 0; } public void writeToParcel(Parcel dest, int flags) { if (mainThumbnail != null) { dest.writeInt(1); mainThumbnail.writeToParcel(dest, 0); } else { dest.writeInt(0); } dest.writeInt(numSubThumbbails); dest.writeStrongInterface(retriever); } public void readFromParcel(Parcel source) { if (source.readInt() != 0) { mainThumbnail = Bitmap.CREATOR.createFromParcel(source); } else { mainThumbnail = null; } numSubThumbbails = source.readInt(); retriever = IThumbnailRetriever.Stub.asInterface(source.readStrongBinder()); } public static final Creator<TaskThumbnails> CREATOR = new Creator<TaskThumbnails>() { public TaskThumbnails createFromParcel(Parcel source) { return new TaskThumbnails(source); } public TaskThumbnails[] newArray(int size) { return new TaskThumbnails[size]; } }; private TaskThumbnails(Parcel source) { readFromParcel(source); } } /** @hide */ public TaskThumbnails getTaskThumbnails(int id) throws SecurityException { try { return ActivityManagerNative.getDefault().getTaskThumbnail(id); return ActivityManagerNative.getDefault().getTaskThumbnails(id); } catch (RemoteException e) { // System dead, we will be dead too soon! return null; Loading
core/java/android/app/ActivityManagerNative.java +6 −6 Original line number Diff line number Diff line Loading @@ -441,10 +441,10 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } case GET_TASK_THUMBNAIL_TRANSACTION: { case GET_TASK_THUMBNAILS_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int id = data.readInt(); Bitmap bm = getTaskThumbnail(id); ActivityManager.TaskThumbnails bm = getTaskThumbnails(id); reply.writeNoException(); if (bm != null) { reply.writeInt(1); Loading Loading @@ -1830,16 +1830,16 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); return list; } public Bitmap getTaskThumbnail(int id) throws RemoteException { public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeInt(id); mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0); mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0); reply.readException(); Bitmap bm = null; ActivityManager.TaskThumbnails bm = null; if (reply.readInt() != 0) { bm = Bitmap.CREATOR.createFromParcel(reply); bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply); } data.recycle(); reply.recycle(); Loading
core/java/android/app/IActivityManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ public interface IActivityManager extends IInterface { IThumbnailReceiver receiver) throws RemoteException; public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum, int flags) throws RemoteException; public Bitmap getTaskThumbnail(int taskId) throws RemoteException; public ActivityManager.TaskThumbnails getTaskThumbnails(int taskId) throws RemoteException; public List getServices(int maxNum, int flags) throws RemoteException; public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState() throws RemoteException; Loading Loading @@ -515,7 +515,7 @@ public interface IActivityManager extends IInterface { int FORCE_STOP_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+78; int KILL_PIDS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+79; int GET_SERVICES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+80; int GET_TASK_THUMBNAIL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+81; int GET_TASK_THUMBNAILS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+81; int GET_RUNNING_APP_PROCESSES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+82; int GET_DEVICE_CONFIGURATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+83; int PEEK_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+84; Loading
core/java/android/app/IThumbnailRetriever.aidl 0 → 100644 +24 −0 Original line number Diff line number Diff line /* Copyright 2011, 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 android.app; import android.graphics.Bitmap; /** * System private API for retrieving thumbnails */ interface IThumbnailRetriever { Bitmap getThumbnail(int index); }