Update Android API levels and grant permissions
authorMika Väinölä <mika.vainola@siru.fi>
Wed, 3 Apr 2019 13:16:32 +0000 (16:16 +0300)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Mon, 1 Jun 2020 11:21:44 +0000 (07:21 -0400)
Remove <uses-sdk ...> from AndroidManifest.xml; instead, add it in
build_apk.py via aapt. Add "--min-api" option that defaults to 22.
Change target API level to 28. Add "-g" to the ADB install command to
automatically grant all runtime permissions. Update the instructions in
external/vulkancts/README.md.

Components: Android, Framework

VK-GL-CTS issue: 650

Change-Id: I76963ccd43f9c1598e5f1c925347dc68dbc644c3

android/package/AndroidManifest.xml
external/vulkancts/README.md
scripts/android/build_apk.py
scripts/android/install_apk.py

index 79c49f0..360b21a 100644 (file)
@@ -34,7 +34,6 @@
                </activity>
        </application>
 
-       <uses-sdk android:minSdkVersion="13" android:targetSdkVersion="19"/>
        <uses-feature android:glEsVersion="0x00020000"/>
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.GET_TASKS" />
index f14814c..cf27a7e 100644 (file)
@@ -28,15 +28,15 @@ The following tools must be installed and present in the PATH variable:
 
 ### Android
 
- * Android NDK r15c or later.
+ * Android NDK r17c or later.
  * Android SDK with: SDK Tools, SDK Platform-tools, SDK Build-tools, and API 28
  * Java Development Kit (JDK)
  * Windows: either NMake or Ninja in PATH
 
-If you have downloaded Android SDK tools, you can install necessary components
-by running:
+If you have downloaded the Android SDK command line tools package (25.2.3 or higher) then
+you can install the necessary components by running:
 
-       tools/android update sdk --no-ui --all --filter tools,platform-tools,build-tools-25.0.2,android-28
+       tools/bin/sdkmanager tools platform-tools 'build-tools;25.0.2' 'platforms;android-28'
 
 
 Building CTS
@@ -96,12 +96,12 @@ The package can be installed by either running:
        python scripts/android/install_apk.py
 
 By default the CTS package will contain libdeqp.so built for armeabi-v7a, arm64-v8a,
-x86, and x86_64 ABIs, but that can be changed using --abis command line option.
+x86, and x86_64 ABIs, but that can be changed at build time by passing the --abis command line
+option to `scripts/android/build_apk.py`.
 
-To pick which ABI to use at install time, following commands must be used
-instead:
+To pick which ABI to use at _install time_, use the following command instead:
 
-       adb install --abi <ABI name> <build-root>/package/dEQP.apk /data/local/tmp/dEQP-debug.apk
+       adb install -g --abi <ABI name> <build-root>/package/dEQP.apk
 
 
 Building Mustpass
index 4534a1e..1c9cec9 100644 (file)
@@ -169,13 +169,14 @@ class Environment:
                self.ndk                = ndk
 
 class Configuration:
-       def __init__(self, env, buildPath, abis, nativeApi, nativeBuildType, gtfTarget, verbose, layers, angle):
+       def __init__(self, env, buildPath, abis, nativeApi, minApi, nativeBuildType, gtfTarget, verbose, layers, angle):
                self.env                                = env
                self.sourcePath                 = DEQP_DIR
                self.buildPath                  = buildPath
                self.abis                               = abis
                self.nativeApi                  = nativeApi
-               self.javaApi                    = 22
+               self.javaApi                    = 28
+               self.minApi                             = minApi
                self.nativeBuildType    = nativeBuildType
                self.gtfTarget                  = gtfTarget
                self.verbose                    = verbose
@@ -196,6 +197,9 @@ class Configuration:
                if self.env.ndk.version[0] < 15:
                        raise Exception("Android NDK version %d is not supported; build requires NDK version >= 15" % (self.env.ndk.version[0]))
 
+               if not (self.minApi <= self.javaApi <= self.nativeApi):
+                       raise Exception("Requires: min-api (%d) <= java-api (%d) <= native-api (%d)" % (self.minApi, self.javaApi, self.nativeApi))
+
                if self.env.sdk.buildToolsVersion == (0,0,0):
                        raise Exception("No build tools directory found at %s" % os.path.join(self.env.sdk.path, "build-tools"))
 
@@ -614,6 +618,8 @@ class BuildBaseAPK (BuildStep):
                        aaptPath,
                        "package",
                        "-f",
+                       "--min-sdk-version", str(config.minApi),
+                       "--target-sdk-version", str(config.javaApi),
                        "-M", resolvePath(config, self.package.getManifestPath()),
                        "-I", config.env.sdk.getPlatformLibrary(config.javaApi),
                        "-F", dstPath,
@@ -912,6 +918,11 @@ def parseArgs ():
                dest='nativeApi',
                default=28,
                help="Android API level to target in native code")
+       parser.add_argument('--min-api',
+               type=int,
+               dest='minApi',
+               default=22,
+               help="Minimum Android API level for which the APK can be installed")
        parser.add_argument('--sdk',
                dest='sdkPath',
                default=defaultSDKPath,
@@ -979,8 +990,8 @@ if __name__ == "__main__":
        sdk                     = SDKEnv(os.path.realpath(args.sdkPath))
        buildPath       = os.path.realpath(args.buildRoot)
        env                     = Environment(sdk, ndk)
-       config          = Configuration(env, buildPath, abis=args.abis, nativeApi=args.nativeApi, nativeBuildType=args.nativeBuildType, gtfTarget=args.gtfTarget, verbose=args.verbose,
-                                                layers=args.layers, angle=args.angle)
+       config          = Configuration(env, buildPath, abis=args.abis, nativeApi=args.nativeApi, minApi=args.minApi, nativeBuildType=args.nativeBuildType, gtfTarget=args.gtfTarget,
+                                                verbose=args.verbose, layers=args.layers, angle=args.angle)
 
        try:
                config.check()
index 51fe65c..1076dc8 100644 (file)
@@ -128,6 +128,7 @@ def install (adbPath, apkPath, extraArgs = [], printPrefix=""):
        print(printPrefix + "Installing %s...\n" % apkPath,)
        execWithPrintPrefix([adbPath] + extraArgs + [
                        'install',
+                       '-g',
                        apkPath
                ], printPrefix)
        print(printPrefix + "Install complete\n",)