Merge "Fix print page starts multiple activities"
This commit is contained in:
committed by
Android (Google) Code Review
commit
d4cf0b689e
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.settings.print;
|
package com.android.settings.print;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -49,12 +50,14 @@ public abstract class ProfileSettingsPreferenceFragment extends SettingsPreferen
|
|||||||
long id) {
|
long id) {
|
||||||
final UserHandle selectedUser = profileSpinnerAdapter.getUserHandle(position);
|
final UserHandle selectedUser = profileSpinnerAdapter.getUserHandle(position);
|
||||||
if (selectedUser.getIdentifier() != UserHandle.myUserId()) {
|
if (selectedUser.getIdentifier() != UserHandle.myUserId()) {
|
||||||
|
final Activity activity = getActivity();
|
||||||
Intent intent = new Intent(getIntentActionString());
|
Intent intent = new Intent(getIntentActionString());
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
getActivity().startActivityAsUser(intent, selectedUser);
|
activity.startActivityAsUser(intent, selectedUser);
|
||||||
// Go back to default selection, which is the first one
|
// Go back to default selection, which is the first one
|
||||||
spinner.setSelection(0);
|
spinner.setSelection(0);
|
||||||
|
activity.finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user