Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Unified Diff: build/android/gyp/apk_install.py

Issue 1166113002: Add InstallSplitApk function to device utils. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed jbudorick's nits. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/gyp/util/build_device.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/apk_install.py
diff --git a/build/android/gyp/apk_install.py b/build/android/gyp/apk_install.py
index c9098676f1b67e6486a07666c7c9a7db15181651..a512e50e3d5e7163125a1009e5ee9d494cb2e9b4 100755
--- a/build/android/gyp/apk_install.py
+++ b/build/android/gyp/apk_install.py
@@ -23,28 +23,6 @@ sys.path.append(BUILD_ANDROID_DIR)
from pylib import constants
from pylib.utils import apk_helper
-_DPI_TO_DENSITY = {
- 120: 'ldpi',
- 160: 'mdpi',
- 240: 'hdpi',
- 320: 'xhdpi',
- 480: 'xxhdpi',
- }
-
-
-def RetrieveDeviceConfig(device):
- """Probes the given device for its split-select config.
-
- For example: en-rUS-xhdpi:armeabi-v7a
- Run "split-select --help" for more info about the format.
- """
- language = device.GetProp('persist.sys.language')
- country = device.GetProp('persist.sys.country')
- density_dpi = int(device.GetProp('ro.sf.lcd_density'))
- density = _DPI_TO_DENSITY.get(density_dpi, 'tvdpi')
- abi = device.product_cpu_abi
- return '%s-r%s-%s:%s' % (language, country, density, abi)
-
def GetNewMetadata(device, apk_package):
"""Gets the metadata on the device for the apk_package apk."""
@@ -114,34 +92,10 @@ def main():
# the build, then the APK has to be installed (regardless of the md5 record).
force_install = HasInstallMetadataChanged(device, apk_package, metadata_path)
- def SelectSplits(target_config, base_apk, split_apks, android_sdk_tools):
- cmd = [os.path.join(android_sdk_tools, 'split-select'),
- '--target', target_config,
- '--base', base_apk,
- ]
- for split in split_apks:
- cmd.extend(('--split', split))
-
- # split-select outputs one path per line and a blank line at the end.
- output = build_utils.CheckOutput(cmd)
- return [x for x in output.split('\n') if x]
def Install():
if options.split_apk_path:
- requiredSdkVersion = constants.ANDROID_SDK_VERSION_CODES.LOLLIPOP
- actualSdkVersion = device.device.build_version_sdk
- if actualSdkVersion < requiredSdkVersion:
- raise Exception(('--split-apk-path requires sdk version %s. Device has '
- 'version %s') % (requiredSdkVersion, actualSdkVersion))
- device_config = RetrieveDeviceConfig(device.device)
- active_splits = SelectSplits(
- device_config,
- options.apk_path,
- options.split_apk_path,
- options.android_sdk_tools)
-
- all_apks = [options.apk_path] + active_splits
- device.device.adb.InstallMultiple(all_apks, reinstall=True)
+ device.InstallSplitApk(options.apk_path, options.split_apk_path)
else:
device.Install(options.apk_path, reinstall=True)
« no previous file with comments | « no previous file | build/android/gyp/util/build_device.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698