android.app.ActivityManager.TaskDescription Java Examples
The following examples show how to use
android.app.ActivityManager.TaskDescription.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Task.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
Task(int taskId, TaskStack stack, int userId, WindowManagerService service, int resizeMode, boolean supportsPictureInPicture, TaskDescription taskDescription, TaskWindowContainerController controller) { super(service); mTaskId = taskId; mStack = stack; mUserId = userId; mResizeMode = resizeMode; mSupportsPictureInPicture = supportsPictureInPicture; setController(controller); setBounds(getOverrideBounds()); mTaskDescription = taskDescription; // Tasks have no set orientation value (including SCREEN_ORIENTATION_UNSPECIFIED). setOrientation(SCREEN_ORIENTATION_UNSET); }
Example #2
Source File: TaskWindowContainerController.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
public TaskWindowContainerController(int taskId, TaskWindowContainerListener listener, StackWindowController stackController, int userId, Rect bounds, int resizeMode, boolean supportsPictureInPicture, boolean toTop, boolean showForAllUsers, TaskDescription taskDescription, WindowManagerService service) { super(listener, service); mTaskId = taskId; mHandler = new H(new WeakReference<>(this), service.mH.getLooper()); synchronized(mWindowMap) { if (DEBUG_STACK) Slog.i(TAG_WM, "TaskWindowContainerController: taskId=" + taskId + " stack=" + stackController + " bounds=" + bounds); final TaskStack stack = stackController.mContainer; if (stack == null) { throw new IllegalArgumentException("TaskWindowContainerController: invalid stack=" + stackController); } EventLog.writeEvent(WM_TASK_CREATED, taskId, stack.mStackId); final Task task = createTask(taskId, stack, userId, resizeMode, supportsPictureInPicture, taskDescription); final int position = toTop ? POSITION_TOP : POSITION_BOTTOM; // We only want to move the parents to the parents if we are creating this task at the // top of its stack. stack.addTask(task, position, showForAllUsers, toTop /* moveParents */); } }
Example #3
Source File: TaskRecord.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** * Should only be used when we're restoring {@link TaskRecord} from storage. */ TaskRecord create(ActivityManagerService service, int taskId, Intent intent, Intent affinityIntent, String affinity, String rootAffinity, ComponentName realActivity, ComponentName origActivity, boolean rootWasReset, boolean autoRemoveRecents, boolean askedCompatMode, int userId, int effectiveUid, String lastDescription, ArrayList<ActivityRecord> activities, long lastTimeMoved, boolean neverRelinquishIdentity, TaskDescription lastTaskDescription, int taskAffiliation, int prevTaskId, int nextTaskId, int taskAffiliationColor, int callingUid, String callingPackage, int resizeMode, boolean supportsPictureInPicture, boolean realActivitySuspended, boolean userSetupComplete, int minWidth, int minHeight) { return new TaskRecord(service, taskId, intent, affinityIntent, affinity, rootAffinity, realActivity, origActivity, rootWasReset, autoRemoveRecents, askedCompatMode, userId, effectiveUid, lastDescription, activities, lastTimeMoved, neverRelinquishIdentity, lastTaskDescription, taskAffiliation, prevTaskId, nextTaskId, taskAffiliationColor, callingUid, callingPackage, resizeMode, supportsPictureInPicture, realActivitySuspended, userSetupComplete, minWidth, minHeight); }
Example #4
Source File: TaskRecord.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** * Don't use constructor directly. Use {@link #create(ActivityManagerService, int, ActivityInfo, * Intent, IVoiceInteractionSession, IVoiceInteractor)} instead. */ TaskRecord(ActivityManagerService service, int _taskId, ActivityInfo info, Intent _intent, TaskDescription _taskDescription) { mService = service; userId = UserHandle.getUserId(info.applicationInfo.uid); taskId = _taskId; lastActiveTime = SystemClock.elapsedRealtime(); mAffiliatedTaskId = _taskId; voiceSession = null; voiceInteractor = null; isAvailable = true; mActivities = new ArrayList<>(); mCallingUid = info.applicationInfo.uid; mCallingPackage = info.packageName; setIntent(_intent, info); setMinDimensions(info); isPersistable = true; // Clamp to [1, max]. maxRecents = Math.min(Math.max(info.maxRecents, 1), ActivityManager.getMaxAppRecentsLimitStatic()); lastTaskDescription = _taskDescription; touchActiveTime(); mService.mTaskChangeNotificationController.notifyTaskCreated(_taskId, realActivity); }
Example #5
Source File: TelecineActivity.java From Telecine with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); if ("true".equals(getIntent().getStringExtra("crash"))) { throw new RuntimeException("Crash! Bang! Pow! This is only a test..."); } setContentView(R.layout.activity_main); ButterKnife.bind(this); CheatSheet.setup(launchView); setTaskDescription(new TaskDescription(appName, rasterizeTaskIcon(), primaryNormal)); videoSizePercentageAdapter = new VideoSizePercentageAdapter(this); videoSizePercentageView.setAdapter(videoSizePercentageAdapter); videoSizePercentageView.setSelection( VideoSizePercentageAdapter.getSelectedPosition(videoSizePreference.get())); showCountdownView.setChecked(showCountdownPreference.get()); hideFromRecentsView.setChecked(hideFromRecentsPreference.get()); recordingNotificationView.setChecked(recordingNotificationPreference.get()); showTouchesView.setChecked(showTouchesPreference.get()); useDemoModeView.setChecked(useDemoModePreference.get()); showDemoModeSetting = new DemoModeHelper.ShowDemoModeSetting() { @Override public void show() { useDemoModeContainerView.setVisibility(VISIBLE); } @Override public void hide() { useDemoModeView.setChecked(false); useDemoModeContainerView.setVisibility(GONE); } }; DemoModeHelper.showDemoModeSetting(this, showDemoModeSetting); }
Example #6
Source File: PresetThemeStore.java From Jockey with Apache License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void applyTaskDescription(Activity activity) { String taskName = mContext.getString(R.string.app_name); int taskColor = getPrimaryColor(); Bitmap taskIcon = getAppIcon(); TaskDescription taskDescription = new TaskDescription(taskName, taskIcon, taskColor); activity.setTaskDescription(taskDescription); }
Example #7
Source File: Colors.java From Colors with Apache License 2.0 | 5 votes |
@RequiresApi(Build.VERSION_CODES.LOLLIPOP) private static void applyTaskDescription(Activity activity, @Nullable String taskName, @Nullable Bitmap taskIcon) { @ColorRes int primaryColorRes = sTheme.getPrimaryColor().getPrimaryColorRes(); @ColorInt int primaryColor = ContextCompat.getColor(activity, primaryColorRes); TaskDescription taskDescription = new TaskDescription(taskName, taskIcon, primaryColor); activity.setTaskDescription(taskDescription); }
Example #8
Source File: ActivityRecord.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
void setTaskDescription(TaskDescription _taskDescription) { Bitmap icon; if (_taskDescription.getIconFilename() == null && (icon = _taskDescription.getIcon()) != null) { final String iconFilename = createImageFilename(createTime, task.taskId); final File iconFile = new File(TaskPersister.getUserImagesDir(task.userId), iconFilename); final String iconFilePath = iconFile.getAbsolutePath(); service.getRecentTasks().saveImage(icon, iconFilePath); _taskDescription.setIconFilename(iconFilePath); } taskDescription = _taskDescription; }
Example #9
Source File: TaskChangeNotificationController.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
void notifyTaskDescriptionChanged(int taskId, TaskDescription taskDescription) { final Message msg = mHandler.obtainMessage(NOTIFY_TASK_DESCRIPTION_CHANGED_LISTENERS_MSG, taskId, 0 /* unused */, taskDescription); forAllLocalListeners(mNotifyTaskDescriptionChanged, msg); msg.sendToTarget(); }
Example #10
Source File: TaskWindowContainerController.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
public void setTaskDescription(TaskDescription taskDescription) { synchronized (mWindowMap) { if (mContainer == null) { Slog.w(TAG_WM, "setTaskDescription: taskId " + mTaskId + " not found."); return; } mContainer.setTaskDescription(taskDescription); } }
Example #11
Source File: TaskWindowContainerController.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
public TaskWindowContainerController(int taskId, TaskWindowContainerListener listener, StackWindowController stackController, int userId, Rect bounds, int resizeMode, boolean supportsPictureInPicture, boolean toTop, boolean showForAllUsers, TaskDescription taskDescription) { this(taskId, listener, stackController, userId, bounds, resizeMode, supportsPictureInPicture, toTop, showForAllUsers, taskDescription, WindowManagerService.getInstance()); }
Example #12
Source File: ActivityRecord.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
static ActivityRecord restoreFromXml(XmlPullParser in, ActivityStackSupervisor stackSupervisor) throws IOException, XmlPullParserException { Intent intent = null; PersistableBundle persistentState = null; int launchedFromUid = 0; String launchedFromPackage = null; String resolvedType = null; boolean componentSpecified = false; int userId = 0; long createTime = -1; final int outerDepth = in.getDepth(); TaskDescription taskDescription = new TaskDescription(); for (int attrNdx = in.getAttributeCount() - 1; attrNdx >= 0; --attrNdx) { final String attrName = in.getAttributeName(attrNdx); final String attrValue = in.getAttributeValue(attrNdx); if (DEBUG) Slog.d(TaskPersister.TAG, "ActivityRecord: attribute name=" + attrName + " value=" + attrValue); if (ATTR_ID.equals(attrName)) { createTime = Long.parseLong(attrValue); } else if (ATTR_LAUNCHEDFROMUID.equals(attrName)) { launchedFromUid = Integer.parseInt(attrValue); } else if (ATTR_LAUNCHEDFROMPACKAGE.equals(attrName)) { launchedFromPackage = attrValue; } else if (ATTR_RESOLVEDTYPE.equals(attrName)) { resolvedType = attrValue; } else if (ATTR_COMPONENTSPECIFIED.equals(attrName)) { componentSpecified = Boolean.parseBoolean(attrValue); } else if (ATTR_USERID.equals(attrName)) { userId = Integer.parseInt(attrValue); } else if (attrName.startsWith(ATTR_TASKDESCRIPTION_PREFIX)) { taskDescription.restoreFromXml(attrName, attrValue); } else { Log.d(TAG, "Unknown ActivityRecord attribute=" + attrName); } } int event; while (((event = in.next()) != END_DOCUMENT) && (event != END_TAG || in.getDepth() >= outerDepth)) { if (event == START_TAG) { final String name = in.getName(); if (DEBUG) Slog.d(TaskPersister.TAG, "ActivityRecord: START_TAG name=" + name); if (TAG_INTENT.equals(name)) { intent = Intent.restoreFromXml(in); if (DEBUG) Slog.d(TaskPersister.TAG, "ActivityRecord: intent=" + intent); } else if (TAG_PERSISTABLEBUNDLE.equals(name)) { persistentState = PersistableBundle.restoreFromXml(in); if (DEBUG) Slog.d(TaskPersister.TAG, "ActivityRecord: persistentState=" + persistentState); } else { Slog.w(TAG, "restoreActivity: unexpected name=" + name); XmlUtils.skipCurrentTag(in); } } } if (intent == null) { throw new XmlPullParserException("restoreActivity error intent=" + intent); } final ActivityManagerService service = stackSupervisor.mService; final ActivityInfo aInfo = stackSupervisor.resolveActivity(intent, resolvedType, 0, null, userId, Binder.getCallingUid()); if (aInfo == null) { throw new XmlPullParserException("restoreActivity resolver error. Intent=" + intent + " resolvedType=" + resolvedType); } final ActivityRecord r = new ActivityRecord(service, null /* caller */, 0 /* launchedFromPid */, launchedFromUid, launchedFromPackage, intent, resolvedType, aInfo, service.getConfiguration(), null /* resultTo */, null /* resultWho */, 0 /* reqCode */, componentSpecified, false /* rootVoiceInteraction */, stackSupervisor, null /* options */, null /* sourceRecord */); r.persistentState = persistentState; r.taskDescription = taskDescription; r.createTime = createTime; return r; }
Example #13
Source File: TaskRecord.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
/** * Don't use constructor directly. This is only used by XML parser. */ TaskRecord(ActivityManagerService service, int _taskId, Intent _intent, Intent _affinityIntent, String _affinity, String _rootAffinity, ComponentName _realActivity, ComponentName _origActivity, boolean _rootWasReset, boolean _autoRemoveRecents, boolean _askedCompatMode, int _userId, int _effectiveUid, String _lastDescription, ArrayList<ActivityRecord> activities, long lastTimeMoved, boolean neverRelinquishIdentity, TaskDescription _lastTaskDescription, int taskAffiliation, int prevTaskId, int nextTaskId, int taskAffiliationColor, int callingUid, String callingPackage, int resizeMode, boolean supportsPictureInPicture, boolean _realActivitySuspended, boolean userSetupComplete, int minWidth, int minHeight) { mService = service; taskId = _taskId; intent = _intent; affinityIntent = _affinityIntent; affinity = _affinity; rootAffinity = _rootAffinity; voiceSession = null; voiceInteractor = null; realActivity = _realActivity; realActivitySuspended = _realActivitySuspended; origActivity = _origActivity; rootWasReset = _rootWasReset; isAvailable = true; autoRemoveRecents = _autoRemoveRecents; askedCompatMode = _askedCompatMode; userId = _userId; mUserSetupComplete = userSetupComplete; effectiveUid = _effectiveUid; lastActiveTime = SystemClock.elapsedRealtime(); lastDescription = _lastDescription; mActivities = activities; mLastTimeMoved = lastTimeMoved; mNeverRelinquishIdentity = neverRelinquishIdentity; lastTaskDescription = _lastTaskDescription; mAffiliatedTaskId = taskAffiliation; mAffiliatedTaskColor = taskAffiliationColor; mPrevAffiliateTaskId = prevTaskId; mNextAffiliateTaskId = nextTaskId; mCallingUid = callingUid; mCallingPackage = callingPackage; mResizeMode = resizeMode; mSupportsPictureInPicture = supportsPictureInPicture; mMinWidth = minWidth; mMinHeight = minHeight; mService.mTaskChangeNotificationController.notifyTaskCreated(_taskId, realActivity); }
Example #14
Source File: TaskRecord.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
static TaskRecord create(ActivityManagerService service, int taskId, ActivityInfo info, Intent intent, TaskDescription taskDescription) { return getTaskRecordFactory().create(service, taskId, info, intent, taskDescription); }
Example #15
Source File: TaskRecord.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
TaskRecord create(ActivityManagerService service, int taskId, ActivityInfo info, Intent intent, TaskDescription taskDescription) { return new TaskRecord(service, taskId, info, intent, taskDescription); }
Example #16
Source File: TaskWindowContainerController.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
@VisibleForTesting Task createTask(int taskId, TaskStack stack, int userId, int resizeMode, boolean supportsPictureInPicture, TaskDescription taskDescription) { return new Task(taskId, stack, userId, mService, resizeMode, supportsPictureInPicture, taskDescription, this); }
Example #17
Source File: Task.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
TaskDescription getTaskDescription() { return mTaskDescription; }
Example #18
Source File: Task.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
void setTaskDescription(TaskDescription taskDescription) { mTaskDescription = taskDescription; }
Example #19
Source File: BlueprintActivity.java From CompositeAndroid with Apache License 2.0 | 2 votes |
/** * Sets information describing the task with this activity for presentation inside the Recents * System UI. When {@link ActivityManager#getRecentTasks} is called, the activities of each task * are traversed in order from the topmost activity to the bottommost. The traversal continues * for each property until a suitable value is found. For each task the taskDescription will be * returned in {@link TaskDescription}. * * @param taskDescription The TaskDescription properties that describe the task with this activity * @see ActivityManager#getRecentTasks * @see TaskDescription */ @Override public void setTaskDescription(TaskDescription taskDescription) { super.setTaskDescription(taskDescription); }
Example #20
Source File: ICompositeActivity.java From CompositeAndroid with Apache License 2.0 | votes |
void setTaskDescription(TaskDescription taskDescription);
Example #21
Source File: ICompositeActivity.java From CompositeAndroid with Apache License 2.0 | votes |
void super_setTaskDescription(TaskDescription taskDescription);