Merge "Only check INTERACT_ACROSS_USERS_FULL when user handle is not current" into main
This commit is contained in:
@@ -136,14 +136,14 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment
|
|||||||
mPackageName = intent.getData().getSchemeSpecificPart();
|
mPackageName = intent.getData().getSchemeSpecificPart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hasInteractAcrossUsersPermission()) {
|
|
||||||
Log.w(TAG, "Intent not valid.");
|
|
||||||
finish();
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
if (intent != null && intent.hasExtra(Intent.EXTRA_USER_HANDLE)) {
|
if (intent != null && intent.hasExtra(Intent.EXTRA_USER_HANDLE)) {
|
||||||
mUserId = ((UserHandle) intent.getParcelableExtra(
|
mUserId = ((UserHandle) intent.getParcelableExtra(Intent.EXTRA_USER_HANDLE))
|
||||||
Intent.EXTRA_USER_HANDLE)).getIdentifier();
|
.getIdentifier();
|
||||||
|
if (mUserId != UserHandle.myUserId() && !hasInteractAcrossUsersFullPermission()) {
|
||||||
|
Log.w(TAG, "Intent not valid.");
|
||||||
|
finish();
|
||||||
|
return "";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mUserId = UserHandle.myUserId();
|
mUserId = UserHandle.myUserId();
|
||||||
}
|
}
|
||||||
@@ -171,7 +171,7 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected boolean hasInteractAcrossUsersPermission() {
|
protected boolean hasInteractAcrossUsersFullPermission() {
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
if (!(activity instanceof SettingsActivity)) {
|
if (!(activity instanceof SettingsActivity)) {
|
||||||
return false;
|
return false;
|
||||||
|
@@ -250,7 +250,7 @@ public class AppInfoWithHeaderTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean hasInteractAcrossUsersPermission() {
|
protected boolean hasInteractAcrossUsersFullPermission() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@ public class AppInfoWithHeaderTest {
|
|||||||
|
|
||||||
private static final class TestFragmentWithoutPermission extends TestFragment {
|
private static final class TestFragmentWithoutPermission extends TestFragment {
|
||||||
@Override
|
@Override
|
||||||
protected boolean hasInteractAcrossUsersPermission() {
|
protected boolean hasInteractAcrossUsersFullPermission() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user