Use ResolveInfo#isCrossProfileIntentForwarderActivity in DocsUI
Bug: 150283377
Test: atest DocumentsUIGoogleTests
Change-Id: Ibfbaead63e0588a6e90ecc59f59dd9dfbb464dca
diff --git a/src/com/android/documentsui/UserIdManager.java b/src/com/android/documentsui/UserIdManager.java
index 2d80f8c..3458fd9 100644
--- a/src/com/android/documentsui/UserIdManager.java
+++ b/src/com/android/documentsui/UserIdManager.java
@@ -26,7 +26,6 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
-import android.os.Build;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.Log;
@@ -37,6 +36,7 @@
import com.android.documentsui.base.Features;
import com.android.documentsui.base.UserId;
+import com.android.documentsui.util.VersionUtils;
import java.util.ArrayList;
import java.util.List;
@@ -213,8 +213,7 @@
private static boolean isDeviceSupported(Context context) {
// The feature requires Android R DocumentsContract APIs and INTERACT_ACROSS_USERS
// permission.
- return (Build.VERSION.CODENAME.equals("R")
- || (Build.VERSION.CODENAME.equals("REL") && Build.VERSION.SDK_INT >= 30))
+ return VersionUtils.isAtLeastR()
&& context.checkSelfPermission(Manifest.permission.INTERACT_ACROSS_USERS)
== PackageManager.PERMISSION_GRANTED;
}