diff options
| author | Wale Ogunwale <ogunwale@google.com> | 2020-11-14 22:33:06 -0800 |
|---|---|---|
| committer | Wale Ogunwale <ogunwale@google.com> | 2020-11-30 06:57:29 -0800 |
| commit | 071e95e8afb47c9053ba79ddbccf0cb3b8049aa8 (patch) | |
| tree | 22a621c29e6c3758c1b6a2317b632534c89b6c89 /core/java/android/app/ActivityTaskManager.java | |
| parent | 3a9b54f70487cd139c9c4d1bf740cf30a3564aba (diff) | |
Switch some recent tasks calls from IATM to ATM
The aidl IActivityTaskManager interface doesn't allow for method
overloading with the same name. Switching some of these calls to use
ActivityTaskManager class instead makes it easier to have overloads in
upcoming CLs.
Test: they pass!
Bug: 172776536
Change-Id: Ic4895ccf7dc1207cc6b14004cfcf6ee7b4b76cc1
Diffstat (limited to 'core/java/android/app/ActivityTaskManager.java')
| -rw-r--r-- | core/java/android/app/ActivityTaskManager.java | 109 |
1 files changed, 107 insertions, 2 deletions
diff --git a/core/java/android/app/ActivityTaskManager.java b/core/java/android/app/ActivityTaskManager.java index c7b90897c8e7..03c1a011f198 100644 --- a/core/java/android/app/ActivityTaskManager.java +++ b/core/java/android/app/ActivityTaskManager.java @@ -27,7 +27,6 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Rect; import android.os.Build; -import android.os.Handler; import android.os.IBinder; import android.os.Parcel; import android.os.Parcelable; @@ -35,6 +34,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.util.DisplayMetrics; import android.util.Singleton; +import android.view.RemoteAnimationDefinition; import java.util.List; @@ -147,7 +147,20 @@ public class ActivityTaskManager { private static int sMaxRecentTasks = -1; - ActivityTaskManager(Context context, Handler handler) { + private static final Singleton<ActivityTaskManager> sInstance = + new Singleton<ActivityTaskManager>() { + @Override + protected ActivityTaskManager create() { + return new ActivityTaskManager(); + } + }; + + private ActivityTaskManager() { + } + + /** @hide */ + public static ActivityTaskManager getInstance() { + return sInstance.get(); } /** @hide */ @@ -444,6 +457,98 @@ public class ActivityTaskManager { } /** + * @return List of running tasks. + * @hide + */ + public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum) { + return getTasks(maxNum, false /* filterForVisibleRecents */); + } + + /** + * @return List of running tasks that can be filtered by visibility in recents. + * @hide + */ + public List<ActivityManager.RunningTaskInfo> getTasks( + int maxNum, boolean filterOnlyVisibleRecents) { + try { + return getService().getTasks(maxNum, filterOnlyVisibleRecents); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * @return List of recent tasks. + * @hide + */ + public List<ActivityManager.RecentTaskInfo> getRecentTasks( + int maxNum, int flags, int userId) { + try { + return getService().getRecentTasks(maxNum, flags, userId).getList(); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** @hide */ + public void registerTaskStackListener(TaskStackListener listener) { + try { + getService().registerTaskStackListener(listener); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** @hide */ + public void unregisterTaskStackListener(TaskStackListener listener) { + try { + getService().unregisterTaskStackListener(listener); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** @hide */ + public Rect getTaskBounds(int taskId) { + try { + return getService().getTaskBounds(taskId); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * Registers remote animations for a display. + * @hide + */ + public void registerRemoteAnimationsForDisplay( + int displayId, RemoteAnimationDefinition definition) { + try { + getService().registerRemoteAnimationsForDisplay(displayId, definition); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** @hide */ + public boolean isInLockTaskMode() { + try { + return getService().isInLockTaskMode(); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** @hide */ + public boolean removeTask(int taskId) { + try { + return getService().removeTask(taskId); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** * Information you can retrieve about a root task in the system. * @hide */ |
