Make next activity opaque when media stops
Call convertFromTranslucent on next activity when an activity below it stops playing media. Fixes bug 14469711. Change-Id: I7e4346987cb620cb3a8c09096ff3a639cf344679
This commit is contained in:
committed by
Jose Ricardo Lima
parent
b46dea562c
commit
fa387ad6cf
@@ -1099,6 +1099,51 @@ final class ActivityStack {
|
||||
}
|
||||
}
|
||||
|
||||
// Find the first visible activity above the passed activity and if it is translucent return it
|
||||
// otherwise return null;
|
||||
ActivityRecord findNextTranslucentActivity(ActivityRecord r) {
|
||||
TaskRecord task = r.task;
|
||||
if (task == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ActivityStack stack = task.stack;
|
||||
if (stack == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int stackNdx = mStacks.indexOf(stack);
|
||||
|
||||
ArrayList<TaskRecord> tasks = stack.mTaskHistory;
|
||||
int taskNdx = tasks.indexOf(task);
|
||||
|
||||
ArrayList<ActivityRecord> activities = task.mActivities;
|
||||
int activityNdx = activities.indexOf(r) + 1;
|
||||
|
||||
final int numStacks = mStacks.size();
|
||||
while (stackNdx < numStacks) {
|
||||
tasks = mStacks.get(stackNdx).mTaskHistory;
|
||||
final int numTasks = tasks.size();
|
||||
while (taskNdx < numTasks) {
|
||||
activities = tasks.get(taskNdx).mActivities;
|
||||
final int numActivities = activities.size();
|
||||
while (activityNdx < numActivities) {
|
||||
final ActivityRecord activity = activities.get(activityNdx);
|
||||
if (!activity.finishing) {
|
||||
return activity.fullscreen ? null : activity;
|
||||
}
|
||||
++activityNdx;
|
||||
}
|
||||
activityNdx = 0;
|
||||
++taskNdx;
|
||||
}
|
||||
taskNdx = 0;
|
||||
++stackNdx;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// Checks if any of the stacks above this one has a fullscreen activity behind it.
|
||||
// If so, this stack is hidden, otherwise it is visible.
|
||||
private boolean isStackVisible() {
|
||||
|
||||
@@ -2680,6 +2680,13 @@ public final class ActivityStackSupervisor implements DisplayListener {
|
||||
}
|
||||
|
||||
stack.setMediaPlayer(playing ? r : null);
|
||||
if (!playing) {
|
||||
// Make the activity immediately above r opaque.
|
||||
final ActivityRecord next = stack.findNextTranslucentActivity(r);
|
||||
if (next != null) {
|
||||
mService.convertFromTranslucent(next.appToken);
|
||||
}
|
||||
}
|
||||
try {
|
||||
top.app.thread.scheduleBackgroundMediaPlayingChanged(top.appToken, playing);
|
||||
} catch (RemoteException e) {
|
||||
|
||||
Reference in New Issue
Block a user