use of android.app.ActivityManager.TaskDescription in project Telecine by JakeWharton.
the class TelecineActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if ("true".equals(getIntent().getStringExtra("crash"))) {
throw new RuntimeException("Crash! Bang! Pow! This is only a test...");
}
((TelecineApplication) getApplication()).injector().inject(this);
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);
}
use of android.app.ActivityManager.TaskDescription in project android_frameworks_base by AOSPA.
the class TaskRecord method updateTaskDescription.
/** Updates the last task description values. */
void updateTaskDescription() {
// Traverse upwards looking for any break between main task activities and
// utility activities.
int activityNdx;
final int numActivities = mActivities.size();
final boolean relinquish = numActivities == 0 ? false : (mActivities.get(0).info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) != 0;
for (activityNdx = Math.min(numActivities, 1); activityNdx < numActivities; ++activityNdx) {
final ActivityRecord r = mActivities.get(activityNdx);
if (relinquish && (r.info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0) {
// This will be the top activity for determining taskDescription. Pre-inc to
// overcome initial decrement below.
++activityNdx;
break;
}
if (r.intent != null && (r.intent.getFlags() & Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET) != 0) {
break;
}
}
if (activityNdx > 0) {
// Traverse downwards starting below break looking for set label, icon.
// Note that if there are activities in the task but none of them set the
// recent activity values, then we do not fall back to the last set
// values in the TaskRecord.
String label = null;
String iconFilename = null;
int colorPrimary = 0;
int colorBackground = 0;
for (--activityNdx; activityNdx >= 0; --activityNdx) {
final ActivityRecord r = mActivities.get(activityNdx);
if (r.taskDescription != null) {
if (label == null) {
label = r.taskDescription.getLabel();
}
if (iconFilename == null) {
iconFilename = r.taskDescription.getIconFilename();
}
if (colorPrimary == 0) {
colorPrimary = r.taskDescription.getPrimaryColor();
}
if (colorBackground == 0) {
colorBackground = r.taskDescription.getBackgroundColor();
}
}
}
lastTaskDescription = new TaskDescription(label, null, iconFilename, colorPrimary, colorBackground);
// Update the task affiliation color if we are the parent of the group
if (taskId == mAffiliatedTaskId) {
mAffiliatedTaskColor = lastTaskDescription.getPrimaryColor();
}
}
}
use of android.app.ActivityManager.TaskDescription in project android_frameworks_base by DirtyUnicorns.
the class ActivityRecord method restoreFromXml.
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 (TaskPersister.DEBUG)
Slog.d(TaskPersister.TAG, "ActivityRecord: attribute name=" + attrName + " value=" + attrValue);
if (ATTR_ID.equals(attrName)) {
createTime = Long.valueOf(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.valueOf(attrValue);
} else if (ATTR_USERID.equals(attrName)) {
userId = Integer.parseInt(attrValue);
} else if (attrName.startsWith(TaskDescription.ATTR_TASKDESCRIPTION_PREFIX)) {
taskDescription.restoreFromXml(attrName, attrValue);
} else {
Log.d(TAG, "Unknown ActivityRecord attribute=" + attrName);
}
}
int event;
while (((event = in.next()) != XmlPullParser.END_DOCUMENT) && (event != XmlPullParser.END_TAG || in.getDepth() >= outerDepth)) {
if (event == XmlPullParser.START_TAG) {
final String name = in.getName();
if (TaskPersister.DEBUG)
Slog.d(TaskPersister.TAG, "ActivityRecord: START_TAG name=" + name);
if (TAG_INTENT.equals(name)) {
intent = Intent.restoreFromXml(in);
if (TaskPersister.DEBUG)
Slog.d(TaskPersister.TAG, "ActivityRecord: intent=" + intent);
} else if (TAG_PERSISTABLEBUNDLE.equals(name)) {
persistentState = PersistableBundle.restoreFromXml(in);
if (TaskPersister.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);
if (aInfo == null) {
throw new XmlPullParserException("restoreActivity resolver error. Intent=" + intent + " resolvedType=" + resolvedType);
}
final ActivityRecord r = new ActivityRecord(service, /*caller*/
null, launchedFromUid, launchedFromPackage, intent, resolvedType, aInfo, service.getConfiguration(), null, null, 0, componentSpecified, false, stackSupervisor, null, null, null);
r.persistentState = persistentState;
r.taskDescription = taskDescription;
r.createTime = createTime;
return r;
}
use of android.app.ActivityManager.TaskDescription in project android_frameworks_base by DirtyUnicorns.
the class TaskRecord method updateTaskDescription.
/** Updates the last task description values. */
void updateTaskDescription() {
// Traverse upwards looking for any break between main task activities and
// utility activities.
int activityNdx;
final int numActivities = mActivities.size();
final boolean relinquish = numActivities == 0 ? false : (mActivities.get(0).info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) != 0;
for (activityNdx = Math.min(numActivities, 1); activityNdx < numActivities; ++activityNdx) {
final ActivityRecord r = mActivities.get(activityNdx);
if (relinquish && (r.info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0) {
// This will be the top activity for determining taskDescription. Pre-inc to
// overcome initial decrement below.
++activityNdx;
break;
}
if (r.intent != null && (r.intent.getFlags() & Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET) != 0) {
break;
}
}
if (activityNdx > 0) {
// Traverse downwards starting below break looking for set label, icon.
// Note that if there are activities in the task but none of them set the
// recent activity values, then we do not fall back to the last set
// values in the TaskRecord.
String label = null;
String iconFilename = null;
int colorPrimary = 0;
int colorBackground = 0;
for (--activityNdx; activityNdx >= 0; --activityNdx) {
final ActivityRecord r = mActivities.get(activityNdx);
if (r.taskDescription != null) {
if (label == null) {
label = r.taskDescription.getLabel();
}
if (iconFilename == null) {
iconFilename = r.taskDescription.getIconFilename();
}
if (colorPrimary == 0) {
colorPrimary = r.taskDescription.getPrimaryColor();
}
if (colorBackground == 0) {
colorBackground = r.taskDescription.getBackgroundColor();
}
}
}
lastTaskDescription = new TaskDescription(label, null, iconFilename, colorPrimary, colorBackground);
// Update the task affiliation color if we are the parent of the group
if (taskId == mAffiliatedTaskId) {
mAffiliatedTaskColor = lastTaskDescription.getPrimaryColor();
}
}
}
use of android.app.ActivityManager.TaskDescription in project android_frameworks_base by ResurrectionRemix.
the class ActivityRecord method restoreFromXml.
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 (TaskPersister.DEBUG)
Slog.d(TaskPersister.TAG, "ActivityRecord: attribute name=" + attrName + " value=" + attrValue);
if (ATTR_ID.equals(attrName)) {
createTime = Long.valueOf(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.valueOf(attrValue);
} else if (ATTR_USERID.equals(attrName)) {
userId = Integer.parseInt(attrValue);
} else if (attrName.startsWith(TaskDescription.ATTR_TASKDESCRIPTION_PREFIX)) {
taskDescription.restoreFromXml(attrName, attrValue);
} else {
Log.d(TAG, "Unknown ActivityRecord attribute=" + attrName);
}
}
int event;
while (((event = in.next()) != XmlPullParser.END_DOCUMENT) && (event != XmlPullParser.END_TAG || in.getDepth() >= outerDepth)) {
if (event == XmlPullParser.START_TAG) {
final String name = in.getName();
if (TaskPersister.DEBUG)
Slog.d(TaskPersister.TAG, "ActivityRecord: START_TAG name=" + name);
if (TAG_INTENT.equals(name)) {
intent = Intent.restoreFromXml(in);
if (TaskPersister.DEBUG)
Slog.d(TaskPersister.TAG, "ActivityRecord: intent=" + intent);
} else if (TAG_PERSISTABLEBUNDLE.equals(name)) {
persistentState = PersistableBundle.restoreFromXml(in);
if (TaskPersister.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);
if (aInfo == null) {
throw new XmlPullParserException("restoreActivity resolver error. Intent=" + intent + " resolvedType=" + resolvedType);
}
final ActivityRecord r = new ActivityRecord(service, /*caller*/
null, launchedFromUid, launchedFromPackage, intent, resolvedType, aInfo, service.getConfiguration(), null, null, 0, componentSpecified, false, stackSupervisor, null, null, null);
r.persistentState = persistentState;
r.taskDescription = taskDescription;
r.createTime = createTime;
return r;
}
Aggregations