Migrate apex/sdkextensions to packages/modules/SdkExtensions
BUG: 156286599 Test: TH and Forrest (mainline_modules) Merged-In: I6f562fe5e01179c48c39cd72ff381fc800d0d14d Change-Id: I0009d286205d7942c2d681936bfba38e074700d2
This commit is contained in:
@@ -1,84 +0,0 @@
|
||||
// Copyright (C) 2019 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package {
|
||||
default_visibility: [":__subpackages__"],
|
||||
}
|
||||
|
||||
apex {
|
||||
name: "com.android.sdkext",
|
||||
defaults: [ "com.android.sdkext-defaults" ],
|
||||
binaries: [ "derive_sdk" ],
|
||||
prebuilts: [ "cur_sdkinfo" ],
|
||||
manifest: "manifest.json",
|
||||
min_sdk_version: "current",
|
||||
}
|
||||
|
||||
apex_defaults {
|
||||
name: "com.android.sdkext-defaults",
|
||||
updatable: true,
|
||||
min_sdk_version: "R",
|
||||
java_libs: [ "framework-sdkextensions" ],
|
||||
prebuilts: [
|
||||
"derive_sdk.rc",
|
||||
],
|
||||
key: "com.android.sdkext.key",
|
||||
certificate: ":com.android.sdkext.certificate",
|
||||
}
|
||||
|
||||
sdk {
|
||||
name: "sdkextensions-sdk",
|
||||
java_sdk_libs: [ "framework-sdkextensions" ],
|
||||
}
|
||||
|
||||
apex_key {
|
||||
name: "com.android.sdkext.key",
|
||||
public_key: "com.android.sdkext.avbpubkey",
|
||||
private_key: "com.android.sdkext.pem",
|
||||
}
|
||||
|
||||
android_app_certificate {
|
||||
name: "com.android.sdkext.certificate",
|
||||
certificate: "com.android.sdkext",
|
||||
}
|
||||
|
||||
python_binary_host {
|
||||
name: "gen_sdkinfo",
|
||||
srcs: [
|
||||
"sdk.proto",
|
||||
"gen_sdkinfo.py",
|
||||
],
|
||||
proto: {
|
||||
canonical_path_from_root: false,
|
||||
},
|
||||
version: {
|
||||
py3: {
|
||||
embedded_launcher: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
gensrcs {
|
||||
name: "cur_sdkinfo_src",
|
||||
srcs: [""],
|
||||
tools: [ "gen_sdkinfo" ],
|
||||
cmd: "$(location) -v 0 -o $(out)",
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "cur_sdkinfo",
|
||||
src: ":cur_sdkinfo_src",
|
||||
filename: "sdkinfo.binarypb",
|
||||
installable: false,
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
dariofreni@google.com
|
||||
hansson@google.com
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"presubmit": [
|
||||
{
|
||||
"name": "CtsSdkExtensionsTestCases"
|
||||
},
|
||||
{
|
||||
"name": "sdkextensions_e2e_tests"
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
@@ -1,51 +0,0 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIJKQIBAAKCAgEAr72pTSavrziDP54AtQZlRclDxJf9HXRZwFRbYx9hWZ4z7ZtO
|
||||
pNBDPvPJCiAOVUsILgCQhBUolz2dyLob25Fd0PVp0n9ibIPEQYjTfHjOK40qb57N
|
||||
LhEp2ceGiAfsywPSi0TH1PQ6JgbCe/RM4TefI/sj3gYJPka3ksMvylhMIgUVLgME
|
||||
kYizhzwHqlLMspB858SioREZdGwcdZrMMIajGFU69Q9ZRDBzhPvxyKhYoObcOtk1
|
||||
uVaiE/fNoi3wKGJz2l2vhUuNrQW7MWlVMag+Qes4YACUTk9LZrOVFEJFjWc8xGUi
|
||||
ABtfKGs5JgNr/sWnhvifLn8lJuf0/BJmjD+L5QwXYs2cS7gcZJt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kcTJcY5wevrjUUGcHQ86cAyDBHRngkuLVODkRZpU0Y9lN8TFVfVPre6sIX
|
||||
ag6nffJRCD8tB+V2RtBGMKunV4ctHt1oY/Oz34W260aJynoIjjG1ANEpJK4xQdNx
|
||||
0O9FAoIBAQCz2AGGKemHswdEwveEkuaSWpA3Bekj7lYkmTchHH9EU7JyAkx3qhDD
|
||||
QXB2hxGXawf1tsqAmypQwiJ+gGeCz6mW9UkGRF1DX9XX4yc2I5rew2a4RXAxc/Xz
|
||||
pP70i8O5I43Wn7FEusOyY2aAis1Y/eb4EQ+56QTAw5wXa3DwidRbCIJ2XDnT6oRy
|
||||
CWUnAYMG7ek/9TB2Wq5OWCn2B5S79IdmZsLZb+5qbMT3u1xcwO1Xy8jJc27IGpv6
|
||||
ZsDqCTV1/aJ+XQnWpBg28tiV3Sle6pjUzTRJh5AhWcEZRbKMSOiJI/CBY4k2Qq6t
|
||||
xuuEdgFjL7T+mTepqehUglcyiPuLEtAhAoIBAQDDQ5pTFOlunfYzm+CIvvImAgy7
|
||||
vrEabJYABATytAbXRMMbrKoEdU2ApEDyEW7PgysDnYLAZ+icObnJlBTYvNdlWFly
|
||||
XiviGVfpjFWDT9U/gUwFQu2lfEjoiivoGS92USHUy4UMVHiiznnm20VLLkgd3xna
|
||||
HUNSDdHIEgzOTmDsKJwMfA9zGckx23JJimPR5ekv6vr6QllYtECs4lTC1gVQAp2f
|
||||
5daxHRbkmO6gw1RgQADLkAnYz3aI1jNuHm5VyAZGt/d3JCtZ3Wwwejll8uJ4J09G
|
||||
oEtqyY9RVeHK50bLO4lyAXFiE+J6qqXjsGC20cpxeZYW5llMY/dhA6WV4YXV
|
||||
-----END RSA PRIVATE KEY-----
|
||||
Binary file not shown.
@@ -1,35 +0,0 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIGIzCCBAugAwIBAgIUXuDL7QvzQh7S6rihWz2KRvCFVT0wDQYJKoZIhvcNAQEL
|
||||
BQAwgZ8xCzAJBgNVBAYT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Wy
|
||||
HiN0G8RJrs/yNEVSDRx8ZhtwTpXVPQxbARbmhNF4/fnolElkmrMP
|
||||
-----END CERTIFICATE-----
|
||||
@@ -1,55 +0,0 @@
|
||||
// Copyright (C) 2019 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
cc_defaults {
|
||||
name: "derive_sdk-defaults",
|
||||
srcs: [
|
||||
"derive_sdk.cpp",
|
||||
"sdk.proto",
|
||||
],
|
||||
proto: {
|
||||
type: "lite",
|
||||
static: true,
|
||||
},
|
||||
min_sdk_version: "current",
|
||||
shared_libs: ["liblog"],
|
||||
// static c++/libbase for smaller size
|
||||
stl: "c++_static",
|
||||
static_libs: ["libbase"],
|
||||
}
|
||||
|
||||
cc_binary {
|
||||
name: "derive_sdk",
|
||||
defaults: [ "derive_sdk-defaults" ],
|
||||
apex_available: [ "com.android.sdkext" ],
|
||||
visibility: [ "//frameworks/base/apex/sdkextensions" ]
|
||||
}
|
||||
|
||||
// Work around testing using a 64-bit test suite on 32-bit test device by
|
||||
// using a prefer32 version of derive_sdk in testing.
|
||||
cc_binary {
|
||||
name: "derive_sdk_prefer32",
|
||||
defaults: [ "derive_sdk-defaults" ],
|
||||
compile_multilib: "prefer32",
|
||||
stem: "derive_sdk",
|
||||
apex_available: [ "test_com.android.sdkext" ],
|
||||
visibility: [ "//frameworks/base/apex/sdkextensions/testing" ],
|
||||
installable: false,
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "derive_sdk.rc",
|
||||
src: "derive_sdk.rc",
|
||||
installable: false,
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "derive_sdk"
|
||||
|
||||
#include <algorithm>
|
||||
#include <dirent.h>
|
||||
#include <iostream>
|
||||
#include <sys/stat.h>
|
||||
#include <vector>
|
||||
|
||||
#include <android-base/file.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <android-base/properties.h>
|
||||
|
||||
#include "frameworks/base/apex/sdkextensions/derive_sdk/sdk.pb.h"
|
||||
|
||||
using com::android::sdkext::proto::SdkVersion;
|
||||
|
||||
int main(int, char**) {
|
||||
std::unique_ptr<DIR, decltype(&closedir)> apex(opendir("/apex"), closedir);
|
||||
if (!apex) {
|
||||
LOG(ERROR) << "Could not read /apex";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
struct dirent* de;
|
||||
std::vector<std::string> paths;
|
||||
while ((de = readdir(apex.get()))) {
|
||||
std::string name = de->d_name;
|
||||
if (name[0] == '.' || name.find('@') != std::string::npos) {
|
||||
// Skip <name>@<ver> dirs, as they are bind-mounted to <name>
|
||||
continue;
|
||||
}
|
||||
std::string path = "/apex/" + name + "/etc/sdkinfo.binarypb";
|
||||
struct stat statbuf;
|
||||
if (stat(path.c_str(), &statbuf) == 0) {
|
||||
paths.push_back(path);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<int> versions;
|
||||
for (const auto& path : paths) {
|
||||
std::string contents;
|
||||
if (!android::base::ReadFileToString(path, &contents, true)) {
|
||||
LOG(ERROR) << "failed to read " << path;
|
||||
continue;
|
||||
}
|
||||
SdkVersion sdk_version;
|
||||
if (!sdk_version.ParseFromString(contents)) {
|
||||
LOG(ERROR) << "failed to parse " << path;
|
||||
continue;
|
||||
}
|
||||
LOG(INFO) << "Read version " << sdk_version.version() << " from " << path;
|
||||
versions.push_back(sdk_version.version());
|
||||
}
|
||||
auto itr = std::min_element(versions.begin(), versions.end());
|
||||
std::string prop_value = itr == versions.end() ? "0" : std::to_string(*itr);
|
||||
|
||||
if (!android::base::SetProperty("build.version.extensions.r", prop_value)) {
|
||||
LOG(ERROR) << "failed to set sdk_info prop";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
LOG(INFO) << "R extension version is " << prop_value;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
service derive_sdk /apex/com.android.sdkext/bin/derive_sdk
|
||||
user nobody
|
||||
group nobody
|
||||
oneshot
|
||||
disabled
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
package com.android.sdkext.proto;
|
||||
|
||||
option java_outer_classname = "SdkProto";
|
||||
option optimize_for = LITE_RUNTIME;
|
||||
|
||||
message SdkVersion {
|
||||
int32 version = 1;
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
// Copyright (C) 2019 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package {
|
||||
default_visibility: [ ":__pkg__" ]
|
||||
}
|
||||
|
||||
filegroup {
|
||||
name: "framework-sdkextensions-sources",
|
||||
srcs: [
|
||||
"java/**/*.java",
|
||||
],
|
||||
path: "java",
|
||||
visibility: [ "//frameworks/base" ] // For the "global" stubs.
|
||||
}
|
||||
|
||||
java_sdk_library {
|
||||
name: "framework-sdkextensions",
|
||||
srcs: [ ":framework-sdkextensions-sources" ],
|
||||
defaults: ["framework-module-defaults"],
|
||||
|
||||
// TODO(b/155480189) - Remove naming_scheme once references have been resolved.
|
||||
// Temporary java_sdk_library component naming scheme to use to ease the transition from separate
|
||||
// modules to java_sdk_library.
|
||||
naming_scheme: "framework-modules",
|
||||
|
||||
permitted_packages: [ "android.os.ext" ],
|
||||
installable: true,
|
||||
visibility: [
|
||||
"//frameworks/base/apex/sdkextensions",
|
||||
"//frameworks/base/apex/sdkextensions/testing",
|
||||
],
|
||||
hostdex: true, // for hiddenapi check
|
||||
apex_available: [
|
||||
"com.android.sdkext",
|
||||
"test_com.android.sdkext",
|
||||
],
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
// Signature format: 2.0
|
||||
@@ -1 +0,0 @@
|
||||
// Signature format: 2.0
|
||||
@@ -1 +0,0 @@
|
||||
// Signature format: 2.0
|
||||
@@ -1 +0,0 @@
|
||||
// Signature format: 2.0
|
||||
@@ -1,9 +0,0 @@
|
||||
// Signature format: 2.0
|
||||
package android.os.ext {
|
||||
|
||||
public class SdkExtensions {
|
||||
method public static int getExtensionVersion(int);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
// Signature format: 2.0
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.os.ext;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Build.VERSION_CODES;
|
||||
import android.os.SystemProperties;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Methods for interacting with the extension SDK.
|
||||
*
|
||||
* This class provides information about the extension SDK version present
|
||||
* on this device. Use the {@link #getExtensionVersion(int) getExtension} to
|
||||
* query for the extension version for the given SDK version.
|
||||
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public class SdkExtensions {
|
||||
|
||||
private static final int R_EXTENSION_INT;
|
||||
static {
|
||||
// Note: when adding more extension versions, the logic that records current
|
||||
// extension versions when saving a rollback must also be updated.
|
||||
// At the time of writing this is in RollbackManagerServiceImpl#getExtensionVersions()
|
||||
R_EXTENSION_INT = SystemProperties.getInt("build.version.extensions.r", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Values suitable as parameters for {@link #getExtensionVersion(int)}.
|
||||
* @hide
|
||||
*/
|
||||
@IntDef(value = { VERSION_CODES.R })
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface SdkVersion {}
|
||||
|
||||
private SdkExtensions() { }
|
||||
|
||||
/**
|
||||
* Return the version of the extension to the given SDK.
|
||||
*
|
||||
* @param sdk the SDK version to get the extension version of.
|
||||
* @see SdkVersion
|
||||
* @throws IllegalArgumentException if sdk is not an sdk version with extensions
|
||||
*/
|
||||
public static int getExtensionVersion(@SdkVersion int sdk) {
|
||||
if (sdk < VERSION_CODES.R) {
|
||||
throw new IllegalArgumentException(String.valueOf(sdk) + " does not have extensions");
|
||||
}
|
||||
|
||||
if (sdk == VERSION_CODES.R) {
|
||||
return R_EXTENSION_INT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
<HTML>
|
||||
<BODY>
|
||||
Provides APIs to interface with the SDK extensions.
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -1,19 +0,0 @@
|
||||
import sdk_pb2
|
||||
import sys
|
||||
|
||||
if __name__ == '__main__':
|
||||
argv = sys.argv[1:]
|
||||
if not len(argv) == 4 or sorted([argv[0], argv[2]]) != ['-o', '-v']:
|
||||
print('usage: gen_sdkinfo -v <version> -o <output-file>')
|
||||
sys.exit(1)
|
||||
|
||||
for i in range(len(argv)):
|
||||
if sys.argv[i] == '-o':
|
||||
filename = sys.argv[i+1]
|
||||
if sys.argv[i] == '-v':
|
||||
version = int(sys.argv[i+1])
|
||||
|
||||
proto = sdk_pb2.SdkVersion()
|
||||
proto.version = version
|
||||
with open(filename, 'wb') as f:
|
||||
f.write(proto.SerializeToString())
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"name": "com.android.sdkext",
|
||||
"version": 300000000
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
package com.android.sdkext.proto;
|
||||
|
||||
option java_outer_classname = "SdkProto";
|
||||
option optimize_for = LITE_RUNTIME;
|
||||
|
||||
message SdkVersion {
|
||||
int32 version = 1;
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
// Copyright (C) 2019 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
apex_test {
|
||||
name: "test_com.android.sdkext",
|
||||
visibility: [ "//system/apex/tests" ],
|
||||
defaults: ["com.android.sdkext-defaults"],
|
||||
manifest: "test_manifest.json",
|
||||
prebuilts: [ "sdkinfo_45" ],
|
||||
file_contexts: ":com.android.sdkext-file_contexts",
|
||||
installable: false, // Should never be installed on the systemimage
|
||||
multilib: {
|
||||
prefer32: {
|
||||
binaries: ["derive_sdk_prefer32"],
|
||||
},
|
||||
},
|
||||
// The automated test infra ends up building this apex for 64+32-bit and
|
||||
// then installs it on a 32-bit-only device. Work around this weirdness
|
||||
// by preferring 32-bit.
|
||||
compile_multilib: "prefer32",
|
||||
}
|
||||
|
||||
genrule {
|
||||
name: "sdkinfo_45_src",
|
||||
out: [ "sdkinfo.binarypb" ],
|
||||
tools: [ "gen_sdkinfo" ],
|
||||
cmd: "$(location) -v 45 -o $(out)",
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "sdkinfo_45",
|
||||
src: ":sdkinfo_45_src",
|
||||
filename: "sdkinfo.binarypb",
|
||||
installable: false,
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"name": "com.android.sdkext",
|
||||
"version": 2147483647
|
||||
}
|
||||
Reference in New Issue
Block a user