Embed build number in non-apex build
Bug: 316978205 Test: m android.hardware.drm-service.widevine Change-Id: Ibf77a0135fa832424f38619bdd2df0ccc53f5849
This commit is contained in:
@@ -216,6 +216,10 @@ cc_library_static {
|
|||||||
"libutils_headers",
|
"libutils_headers",
|
||||||
],
|
],
|
||||||
|
|
||||||
|
generated_headers: [
|
||||||
|
"wv_android_build_id",
|
||||||
|
],
|
||||||
|
|
||||||
shared_libs: [
|
shared_libs: [
|
||||||
"libbinder_ndk",
|
"libbinder_ndk",
|
||||||
"libcrypto",
|
"libcrypto",
|
||||||
@@ -352,3 +356,23 @@ cc_fuzz {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
python_binary_host {
|
||||||
|
name: "wv-android-build-id-gen",
|
||||||
|
srcs: [
|
||||||
|
"wv-android-build-id-gen.py",
|
||||||
|
],
|
||||||
|
version: {
|
||||||
|
py3: {
|
||||||
|
embedded_launcher: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
genrule {
|
||||||
|
name: "wv_android_build_id",
|
||||||
|
srcs: ["apex/apex_manifest.json"],
|
||||||
|
tools: ["wv-android-build-id-gen"],
|
||||||
|
cmd: "$(location wv-android-build-id-gen) < $(in) > $(out)",
|
||||||
|
out: ["wv_android_build_id.h"],
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "properties.h"
|
#include "properties.h"
|
||||||
#include "properties_configuration.h"
|
#include "properties_configuration.h"
|
||||||
|
#include "wv_android_build_id.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@@ -136,15 +137,17 @@ bool Properties::GetWVCdmVersion(std::string* version) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string apex_version = "";
|
std::string build_number;
|
||||||
#ifdef __ANDROID_APEX__
|
#ifdef __ANDROID_APEX__
|
||||||
{
|
{
|
||||||
auto info = widevine::apex::GetApexInfo();
|
auto info = widevine::apex::GetApexInfo();
|
||||||
apex_version = "@" + std::to_string(info->version);
|
build_number = std::to_string(info->version);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
build_number = WV_ANDROID_BUILD_ID;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*version = kWVAndroidCdmVersion + apex_version;
|
*version = kWVAndroidCdmVersion + "@" + build_number;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
27
libwvdrmengine/wv-android-build-id-gen.py
Normal file
27
libwvdrmengine/wv-android-build-id-gen.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import argparse
|
||||||
|
import datetime
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
description = 'APEX Manifest JSON (stdin) to C++ header (stdout)'
|
||||||
|
parser = argparse.ArgumentParser(description=description)
|
||||||
|
parser.add_argument('--guard', type=str,
|
||||||
|
default='WVCDM_WV_ANDROID_BUILD_ID_H_',
|
||||||
|
help='Include guard')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
apex_manifest = json.load(sys.stdin)
|
||||||
|
output = f'''\
|
||||||
|
// Copyright {datetime.date.today().year} Google LLC. All Rights Reserved. This file and proprietary
|
||||||
|
// source code may only be used and distributed under the Widevine License
|
||||||
|
// Agreement.
|
||||||
|
//
|
||||||
|
#ifndef {args.guard}
|
||||||
|
#define {args.guard}
|
||||||
|
|
||||||
|
#define WV_ANDROID_BUILD_ID "{apex_manifest['version']}"
|
||||||
|
|
||||||
|
#endif // {args.guard}'''
|
||||||
|
print(output)
|
||||||
Reference in New Issue
Block a user