Hardcode package ID of dynamic attributes in shared libraries

This hardcodes the package IDs of dynamic attributes to 0x2 and throws
an error in WebLayer if the package ID does not end up being 0x2. This
should not affect WebView, since WebView does not depend on any dynamic
attributes.

The *_pb2.py files were generated from the Resources.proto and
Configuration.proto files in the Android frameworks/base repo.

Bug: 1045262
Change-Id: Ic04c150c5c8709f59f738a84068c0b738f0c4643
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2018493
Reviewed-by: Richard Coles <torne@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#736458}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 5bbf191cd275be695fedd679bdc85eecf54a78a5
This commit is contained in:
Clark DuVall 2020-01-29 18:36:56 +00:00 коммит произвёл Commit Bot
Родитель a664ea6ace
Коммит e129ba2a04
7 изменённых файлов: 3615 добавлений и 0 удалений

Просмотреть файл

@ -48,6 +48,9 @@ def CommonChecks(input_api, output_api):
input_api,
output_api,
white_list=build_pys,
black_list=[
r'.*_pb2\.py',
],
extra_paths_list=[J('gyp'), J('gn')]))
# Disabled due to http://crbug.com/410936

Просмотреть файл

@ -38,6 +38,13 @@ from util import resource_utils
sys.path.insert(1, os.path.join(build_utils.DIR_SOURCE_ROOT, 'third_party'))
from jinja2 import Template # pylint: disable=F0401
# Make sure the pb2 files are able to import google.protobuf
sys.path.insert(
1,
os.path.join(build_utils.DIR_SOURCE_ROOT, 'third_party', 'protobuf',
'python'))
from proto import Resources_pb2
_JETIFY_SCRIPT_PATH = os.path.join(build_utils.DIR_SOURCE_ROOT, 'third_party',
'jetifier_standalone', 'bin',
'jetifier-standalone')
@ -610,6 +617,86 @@ def _CompileDeps(aapt2_path, dep_subdirs, temp_dir):
return partials
def _ProcessProtoItem(item):
if not item.HasField('ref'):
return
# If this is a dynamic attribute (type ATTRIBUTE, package ID 0), hardcode
# the package to 0x02.
if item.ref.type == Resources_pb2.Reference.ATTRIBUTE and not (
item.ref.id & 0xff000000):
item.ref.id |= 0x02000000
item.ref.ClearField('is_dynamic')
def _ProcessProtoValue(value):
if value.HasField('item'):
_ProcessProtoItem(value.item)
else:
compound_value = value.compound_value
if compound_value.HasField('style'):
for entry in compound_value.style.entry:
_ProcessProtoItem(entry.item)
elif compound_value.HasField('array'):
for element in compound_value.array.element:
_ProcessProtoItem(element.item)
elif compound_value.HasField('plural'):
for entry in compound_value.plural.entry:
_ProcessProtoItem(entry.item)
def _ProcessProtoXmlNode(xml_node):
if not xml_node.HasField('element'):
return
for attribute in xml_node.element.attribute:
_ProcessProtoItem(attribute.compiled_item)
for child in xml_node.element.child:
_ProcessProtoXmlNode(child)
def _HardcodeSharedLibraryDynamicAttributes(zip_path):
"""Hardcodes the package IDs of dynamic attributes to 0x02.
This is a workaround for b/147674078, which affects Android versions pre-N.
Args:
zip_path: Path to proto APK file.
"""
with build_utils.TempDir() as tmp_dir:
build_utils.ExtractAll(zip_path, path=tmp_dir)
# First process the resources file.
table = Resources_pb2.ResourceTable()
with open(os.path.join(tmp_dir, 'resources.pb')) as f:
table.ParseFromString(f.read())
for package in table.package:
for _type in package.type:
for entry in _type.entry:
for config_value in entry.config_value:
_ProcessProtoValue(config_value.value)
with open(os.path.join(tmp_dir, 'resources.pb'), 'w') as f:
f.write(table.SerializeToString())
# Next process all the XML files.
xml_files = build_utils.FindInDirectory(tmp_dir, '*.xml')
for xml_file in xml_files:
xml_node = Resources_pb2.XmlNode()
with open(xml_file) as f:
xml_node.ParseFromString(f.read())
_ProcessProtoXmlNode(xml_node)
with open(xml_file, 'w') as f:
f.write(xml_node.SerializeToString())
# Overwrite the original zip file.
build_utils.ZipDir(zip_path, tmp_dir)
def _CreateResourceInfoFile(path_info, info_path, dependencies_res_zips):
for zip_file in dependencies_res_zips:
zip_info_file_path = zip_file + '.info'
@ -833,6 +920,16 @@ def _PackageApk(options, build):
build.proto_path, build.arsc_path
])
# Workaround for b/147674078. This is only needed for WebLayer and does not
# affect WebView usage, since WebView does not used dynamic attributes.
if options.shared_resources:
logging.debug('Hardcoding dynamic attributes')
_HardcodeSharedLibraryDynamicAttributes(build.proto_path)
build_utils.CheckOutput([
options.aapt2_path, 'convert', '--output-format', 'binary', '-o',
build.arsc_path, build.proto_path
])
if build.arsc_path is None:
os.remove(arsc_path)

Просмотреть файл

@ -21,8 +21,34 @@
../../../third_party/markupsafe/__init__.py
../../../third_party/markupsafe/_compat.py
../../../third_party/markupsafe/_native.py
../../../third_party/protobuf/python/google/__init__.py
../../../third_party/protobuf/python/google/protobuf/__init__.py
../../../third_party/protobuf/python/google/protobuf/descriptor.py
../../../third_party/protobuf/python/google/protobuf/descriptor_database.py
../../../third_party/protobuf/python/google/protobuf/descriptor_pool.py
../../../third_party/protobuf/python/google/protobuf/internal/__init__.py
../../../third_party/protobuf/python/google/protobuf/internal/api_implementation.py
../../../third_party/protobuf/python/google/protobuf/internal/containers.py
../../../third_party/protobuf/python/google/protobuf/internal/decoder.py
../../../third_party/protobuf/python/google/protobuf/internal/encoder.py
../../../third_party/protobuf/python/google/protobuf/internal/enum_type_wrapper.py
../../../third_party/protobuf/python/google/protobuf/internal/extension_dict.py
../../../third_party/protobuf/python/google/protobuf/internal/message_listener.py
../../../third_party/protobuf/python/google/protobuf/internal/python_message.py
../../../third_party/protobuf/python/google/protobuf/internal/type_checkers.py
../../../third_party/protobuf/python/google/protobuf/internal/well_known_types.py
../../../third_party/protobuf/python/google/protobuf/internal/wire_format.py
../../../third_party/protobuf/python/google/protobuf/message.py
../../../third_party/protobuf/python/google/protobuf/message_factory.py
../../../third_party/protobuf/python/google/protobuf/reflection.py
../../../third_party/protobuf/python/google/protobuf/symbol_database.py
../../../third_party/protobuf/python/google/protobuf/text_encoding.py
../../../third_party/protobuf/python/google/protobuf/text_format.py
../../gn_helpers.py
compile_resources.py
proto/Configuration_pb2.py
proto/Resources_pb2.py
proto/__init__.py
util/__init__.py
util/build_utils.py
util/diff_utils.py

Просмотреть файл

@ -0,0 +1,697 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: frameworks/base/tools/aapt2/Configuration.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='frameworks/base/tools/aapt2/Configuration.proto',
package='aapt.pb',
syntax='proto3',
serialized_options=_b('\n\020com.android.aapt'),
serialized_pb=_b('\n/frameworks/base/tools/aapt2/Configuration.proto\x12\x07\x61\x61pt.pb\"\xd9\x14\n\rConfiguration\x12\x0b\n\x03mcc\x18\x01 \x01(\r\x12\x0b\n\x03mnc\x18\x02 \x01(\r\x12\x0e\n\x06locale\x18\x03 \x01(\t\x12@\n\x10layout_direction\x18\x04 \x01(\x0e\x32&.aapt.pb.Configuration.LayoutDirection\x12\x14\n\x0cscreen_width\x18\x05 \x01(\r\x12\x15\n\rscreen_height\x18\x06 \x01(\r\x12\x17\n\x0fscreen_width_dp\x18\x07 \x01(\r\x12\x18\n\x10screen_height_dp\x18\x08 \x01(\r\x12 \n\x18smallest_screen_width_dp\x18\t \x01(\r\x12\x43\n\x12screen_layout_size\x18\n \x01(\x0e\x32\'.aapt.pb.Configuration.ScreenLayoutSize\x12\x43\n\x12screen_layout_long\x18\x0b \x01(\x0e\x32\'.aapt.pb.Configuration.ScreenLayoutLong\x12\x38\n\x0cscreen_round\x18\x0c \x01(\x0e\x32\".aapt.pb.Configuration.ScreenRound\x12?\n\x10wide_color_gamut\x18\r \x01(\x0e\x32%.aapt.pb.Configuration.WideColorGamut\x12\'\n\x03hdr\x18\x0e \x01(\x0e\x32\x1a.aapt.pb.Configuration.Hdr\x12\x37\n\x0borientation\x18\x0f \x01(\x0e\x32\".aapt.pb.Configuration.Orientation\x12\x37\n\x0cui_mode_type\x18\x10 \x01(\x0e\x32!.aapt.pb.Configuration.UiModeType\x12\x39\n\rui_mode_night\x18\x11 \x01(\x0e\x32\".aapt.pb.Configuration.UiModeNight\x12\x0f\n\x07\x64\x65nsity\x18\x12 \x01(\r\x12\x37\n\x0btouchscreen\x18\x13 \x01(\x0e\x32\".aapt.pb.Configuration.Touchscreen\x12\x36\n\x0bkeys_hidden\x18\x14 \x01(\x0e\x32!.aapt.pb.Configuration.KeysHidden\x12\x31\n\x08keyboard\x18\x15 \x01(\x0e\x32\x1f.aapt.pb.Configuration.Keyboard\x12\x34\n\nnav_hidden\x18\x16 \x01(\x0e\x32 .aapt.pb.Configuration.NavHidden\x12\x35\n\nnavigation\x18\x17 \x01(\x0e\x32!.aapt.pb.Configuration.Navigation\x12\x13\n\x0bsdk_version\x18\x18 \x01(\r\x12\x0f\n\x07product\x18\x19 \x01(\t\"a\n\x0fLayoutDirection\x12\x1a\n\x16LAYOUT_DIRECTION_UNSET\x10\x00\x12\x18\n\x14LAYOUT_DIRECTION_LTR\x10\x01\x12\x18\n\x14LAYOUT_DIRECTION_RTL\x10\x02\"\xaa\x01\n\x10ScreenLayoutSize\x12\x1c\n\x18SCREEN_LAYOUT_SIZE_UNSET\x10\x00\x12\x1c\n\x18SCREEN_LAYOUT_SIZE_SMALL\x10\x01\x12\x1d\n\x19SCREEN_LAYOUT_SIZE_NORMAL\x10\x02\x12\x1c\n\x18SCREEN_LAYOUT_SIZE_LARGE\x10\x03\x12\x1d\n\x19SCREEN_LAYOUT_SIZE_XLARGE\x10\x04\"m\n\x10ScreenLayoutLong\x12\x1c\n\x18SCREEN_LAYOUT_LONG_UNSET\x10\x00\x12\x1b\n\x17SCREEN_LAYOUT_LONG_LONG\x10\x01\x12\x1e\n\x1aSCREEN_LAYOUT_LONG_NOTLONG\x10\x02\"X\n\x0bScreenRound\x12\x16\n\x12SCREEN_ROUND_UNSET\x10\x00\x12\x16\n\x12SCREEN_ROUND_ROUND\x10\x01\x12\x19\n\x15SCREEN_ROUND_NOTROUND\x10\x02\"h\n\x0eWideColorGamut\x12\x1a\n\x16WIDE_COLOR_GAMUT_UNSET\x10\x00\x12\x1b\n\x17WIDE_COLOR_GAMUT_WIDECG\x10\x01\x12\x1d\n\x19WIDE_COLOR_GAMUT_NOWIDECG\x10\x02\"3\n\x03Hdr\x12\r\n\tHDR_UNSET\x10\x00\x12\x0e\n\nHDR_HIGHDR\x10\x01\x12\r\n\tHDR_LOWDR\x10\x02\"h\n\x0bOrientation\x12\x15\n\x11ORIENTATION_UNSET\x10\x00\x12\x14\n\x10ORIENTATION_PORT\x10\x01\x12\x14\n\x10ORIENTATION_LAND\x10\x02\x12\x16\n\x12ORIENTATION_SQUARE\x10\x03\"\xd7\x01\n\nUiModeType\x12\x16\n\x12UI_MODE_TYPE_UNSET\x10\x00\x12\x17\n\x13UI_MODE_TYPE_NORMAL\x10\x01\x12\x15\n\x11UI_MODE_TYPE_DESK\x10\x02\x12\x14\n\x10UI_MODE_TYPE_CAR\x10\x03\x12\x1b\n\x17UI_MODE_TYPE_TELEVISION\x10\x04\x12\x1a\n\x16UI_MODE_TYPE_APPLIANCE\x10\x05\x12\x16\n\x12UI_MODE_TYPE_WATCH\x10\x06\x12\x1a\n\x16UI_MODE_TYPE_VRHEADSET\x10\x07\"[\n\x0bUiModeNight\x12\x17\n\x13UI_MODE_NIGHT_UNSET\x10\x00\x12\x17\n\x13UI_MODE_NIGHT_NIGHT\x10\x01\x12\x1a\n\x16UI_MODE_NIGHT_NOTNIGHT\x10\x02\"m\n\x0bTouchscreen\x12\x15\n\x11TOUCHSCREEN_UNSET\x10\x00\x12\x17\n\x13TOUCHSCREEN_NOTOUCH\x10\x01\x12\x16\n\x12TOUCHSCREEN_STYLUS\x10\x02\x12\x16\n\x12TOUCHSCREEN_FINGER\x10\x03\"v\n\nKeysHidden\x12\x15\n\x11KEYS_HIDDEN_UNSET\x10\x00\x12\x1b\n\x17KEYS_HIDDEN_KEYSEXPOSED\x10\x01\x12\x1a\n\x16KEYS_HIDDEN_KEYSHIDDEN\x10\x02\x12\x18\n\x14KEYS_HIDDEN_KEYSSOFT\x10\x03\"`\n\x08Keyboard\x12\x12\n\x0eKEYBOARD_UNSET\x10\x00\x12\x13\n\x0fKEYBOARD_NOKEYS\x10\x01\x12\x13\n\x0fKEYBOARD_QWERTY\x10\x02\x12\x16\n\x12KEYBOARD_TWELVEKEY\x10\x03\"V\n\tNavHidden\x12\x14\n\x10NAV_HIDDEN_UNSET\x10\x00\x12\x19\n\x15NAV_HIDDEN_NAVEXPOSED\x10\x01\x12\x18\n\x14NAV_HIDDEN_NAVHIDDEN\x10\x02\"}\n\nNavigation\x12\x14\n\x10NAVIGATION_UNSET\x10\x00\x12\x14\n\x10NAVIGATION_NONAV\x10\x01\x12\x13\n\x0fNAVIGATION_DPAD\x10\x02\x12\x18\n\x14NAVIGATION_TRACKBALL\x10\x03\x12\x14\n\x10NAVIGATION_WHEEL\x10\x04\x42\x12\n\x10\x63om.android.aaptb\x06proto3')
)
_CONFIGURATION_LAYOUTDIRECTION = _descriptor.EnumDescriptor(
name='LayoutDirection',
full_name='aapt.pb.Configuration.LayoutDirection',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='LAYOUT_DIRECTION_UNSET', index=0, number=0,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='LAYOUT_DIRECTION_LTR', index=1, number=1,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='LAYOUT_DIRECTION_RTL', index=2, number=2,
serialized_options=None,
type=None),
],
containing_type=None,
serialized_options=None,
serialized_start=1119,
serialized_end=1216,
)
_sym_db.RegisterEnumDescriptor(_CONFIGURATION_LAYOUTDIRECTION)
_CONFIGURATION_SCREENLAYOUTSIZE = _descriptor.EnumDescriptor(
name='ScreenLayoutSize',
full_name='aapt.pb.Configuration.ScreenLayoutSize',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='SCREEN_LAYOUT_SIZE_UNSET', index=0, number=0,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SCREEN_LAYOUT_SIZE_SMALL', index=1, number=1,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SCREEN_LAYOUT_SIZE_NORMAL', index=2, number=2,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SCREEN_LAYOUT_SIZE_LARGE', index=3, number=3,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SCREEN_LAYOUT_SIZE_XLARGE', index=4, number=4,
serialized_options=None,
type=None),
],
containing_type=None,
serialized_options=None,
serialized_start=1219,
serialized_end=1389,
)
_sym_db.RegisterEnumDescriptor(_CONFIGURATION_SCREENLAYOUTSIZE)
_CONFIGURATION_SCREENLAYOUTLONG = _descriptor.EnumDescriptor(
name='ScreenLayoutLong',
full_name='aapt.pb.Configuration.ScreenLayoutLong',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='SCREEN_LAYOUT_LONG_UNSET', index=0, number=0,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SCREEN_LAYOUT_LONG_LONG', index=1, number=1,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SCREEN_LAYOUT_LONG_NOTLONG', index=2, number=2,
serialized_options=None,
type=None),
],
containing_type=None,
serialized_options=None,
serialized_start=1391,
serialized_end=1500,
)
_sym_db.RegisterEnumDescriptor(_CONFIGURATION_SCREENLAYOUTLONG)
_CONFIGURATION_SCREENROUND = _descriptor.EnumDescriptor(
name='ScreenRound',
full_name='aapt.pb.Configuration.ScreenRound',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='SCREEN_ROUND_UNSET', index=0, number=0,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SCREEN_ROUND_ROUND', index=1, number=1,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SCREEN_ROUND_NOTROUND', index=2, number=2,
serialized_options=None,
type=None),
],
containing_type=None,
serialized_options=None,
serialized_start=1502,
serialized_end=1590,
)
_sym_db.RegisterEnumDescriptor(_CONFIGURATION_SCREENROUND)
_CONFIGURATION_WIDECOLORGAMUT = _descriptor.EnumDescriptor(
name='WideColorGamut',
full_name='aapt.pb.Configuration.WideColorGamut',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='WIDE_COLOR_GAMUT_UNSET', index=0, number=0,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='WIDE_COLOR_GAMUT_WIDECG', index=1, number=1,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='WIDE_COLOR_GAMUT_NOWIDECG', index=2, number=2,
serialized_options=None,
type=None),
],
containing_type=None,
serialized_options=None,
serialized_start=1592,
serialized_end=1696,
)
_sym_db.RegisterEnumDescriptor(_CONFIGURATION_WIDECOLORGAMUT)
_CONFIGURATION_HDR = _descriptor.EnumDescriptor(
name='Hdr',
full_name='aapt.pb.Configuration.Hdr',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='HDR_UNSET', index=0, number=0,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HDR_HIGHDR', index=1, number=1,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HDR_LOWDR', index=2, number=2,
serialized_options=None,
type=None),
],
containing_type=None,
serialized_options=None,
serialized_start=1698,
serialized_end=1749,
)
_sym_db.RegisterEnumDescriptor(_CONFIGURATION_HDR)
_CONFIGURATION_ORIENTATION = _descriptor.EnumDescriptor(
name='Orientation',
full_name='aapt.pb.Configuration.Orientation',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='ORIENTATION_UNSET', index=0, number=0,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ORIENTATION_PORT', index=1, number=1,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ORIENTATION_LAND', index=2, number=2,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ORIENTATION_SQUARE', index=3, number=3,
serialized_options=None,
type=None),
],
containing_type=None,
serialized_options=None,
serialized_start=1751,
serialized_end=1855,
)
_sym_db.RegisterEnumDescriptor(_CONFIGURATION_ORIENTATION)
_CONFIGURATION_UIMODETYPE = _descriptor.EnumDescriptor(
name='UiModeType',
full_name='aapt.pb.Configuration.UiModeType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='UI_MODE_TYPE_UNSET', index=0, number=0,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='UI_MODE_TYPE_NORMAL', index=1, number=1,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='UI_MODE_TYPE_DESK', index=2, number=2,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='UI_MODE_TYPE_CAR', index=3, number=3,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='UI_MODE_TYPE_TELEVISION', index=4, number=4,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='UI_MODE_TYPE_APPLIANCE', index=5, number=5,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='UI_MODE_TYPE_WATCH', index=6, number=6,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='UI_MODE_TYPE_VRHEADSET', index=7, number=7,
serialized_options=None,
type=None),
],
containing_type=None,
serialized_options=None,
serialized_start=1858,
serialized_end=2073,
)
_sym_db.RegisterEnumDescriptor(_CONFIGURATION_UIMODETYPE)
_CONFIGURATION_UIMODENIGHT = _descriptor.EnumDescriptor(
name='UiModeNight',
full_name='aapt.pb.Configuration.UiModeNight',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='UI_MODE_NIGHT_UNSET', index=0, number=0,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='UI_MODE_NIGHT_NIGHT', index=1, number=1,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='UI_MODE_NIGHT_NOTNIGHT', index=2, number=2,
serialized_options=None,
type=None),
],
containing_type=None,
serialized_options=None,
serialized_start=2075,
serialized_end=2166,
)
_sym_db.RegisterEnumDescriptor(_CONFIGURATION_UIMODENIGHT)
_CONFIGURATION_TOUCHSCREEN = _descriptor.EnumDescriptor(
name='Touchscreen',
full_name='aapt.pb.Configuration.Touchscreen',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='TOUCHSCREEN_UNSET', index=0, number=0,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TOUCHSCREEN_NOTOUCH', index=1, number=1,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TOUCHSCREEN_STYLUS', index=2, number=2,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TOUCHSCREEN_FINGER', index=3, number=3,
serialized_options=None,
type=None),
],
containing_type=None,
serialized_options=None,
serialized_start=2168,
serialized_end=2277,
)
_sym_db.RegisterEnumDescriptor(_CONFIGURATION_TOUCHSCREEN)
_CONFIGURATION_KEYSHIDDEN = _descriptor.EnumDescriptor(
name='KeysHidden',
full_name='aapt.pb.Configuration.KeysHidden',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='KEYS_HIDDEN_UNSET', index=0, number=0,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='KEYS_HIDDEN_KEYSEXPOSED', index=1, number=1,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='KEYS_HIDDEN_KEYSHIDDEN', index=2, number=2,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='KEYS_HIDDEN_KEYSSOFT', index=3, number=3,
serialized_options=None,
type=None),
],
containing_type=None,
serialized_options=None,
serialized_start=2279,
serialized_end=2397,
)
_sym_db.RegisterEnumDescriptor(_CONFIGURATION_KEYSHIDDEN)
_CONFIGURATION_KEYBOARD = _descriptor.EnumDescriptor(
name='Keyboard',
full_name='aapt.pb.Configuration.Keyboard',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='KEYBOARD_UNSET', index=0, number=0,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='KEYBOARD_NOKEYS', index=1, number=1,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='KEYBOARD_QWERTY', index=2, number=2,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='KEYBOARD_TWELVEKEY', index=3, number=3,
serialized_options=None,
type=None),
],
containing_type=None,
serialized_options=None,
serialized_start=2399,
serialized_end=2495,
)
_sym_db.RegisterEnumDescriptor(_CONFIGURATION_KEYBOARD)
_CONFIGURATION_NAVHIDDEN = _descriptor.EnumDescriptor(
name='NavHidden',
full_name='aapt.pb.Configuration.NavHidden',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='NAV_HIDDEN_UNSET', index=0, number=0,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='NAV_HIDDEN_NAVEXPOSED', index=1, number=1,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='NAV_HIDDEN_NAVHIDDEN', index=2, number=2,
serialized_options=None,
type=None),
],
containing_type=None,
serialized_options=None,
serialized_start=2497,
serialized_end=2583,
)
_sym_db.RegisterEnumDescriptor(_CONFIGURATION_NAVHIDDEN)
_CONFIGURATION_NAVIGATION = _descriptor.EnumDescriptor(
name='Navigation',
full_name='aapt.pb.Configuration.Navigation',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='NAVIGATION_UNSET', index=0, number=0,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='NAVIGATION_NONAV', index=1, number=1,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='NAVIGATION_DPAD', index=2, number=2,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='NAVIGATION_TRACKBALL', index=3, number=3,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='NAVIGATION_WHEEL', index=4, number=4,
serialized_options=None,
type=None),
],
containing_type=None,
serialized_options=None,
serialized_start=2585,
serialized_end=2710,
)
_sym_db.RegisterEnumDescriptor(_CONFIGURATION_NAVIGATION)
_CONFIGURATION = _descriptor.Descriptor(
name='Configuration',
full_name='aapt.pb.Configuration',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='mcc', full_name='aapt.pb.Configuration.mcc', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='mnc', full_name='aapt.pb.Configuration.mnc', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='locale', full_name='aapt.pb.Configuration.locale', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='layout_direction', full_name='aapt.pb.Configuration.layout_direction', index=3,
number=4, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='screen_width', full_name='aapt.pb.Configuration.screen_width', index=4,
number=5, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='screen_height', full_name='aapt.pb.Configuration.screen_height', index=5,
number=6, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='screen_width_dp', full_name='aapt.pb.Configuration.screen_width_dp', index=6,
number=7, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='screen_height_dp', full_name='aapt.pb.Configuration.screen_height_dp', index=7,
number=8, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='smallest_screen_width_dp', full_name='aapt.pb.Configuration.smallest_screen_width_dp', index=8,
number=9, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='screen_layout_size', full_name='aapt.pb.Configuration.screen_layout_size', index=9,
number=10, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='screen_layout_long', full_name='aapt.pb.Configuration.screen_layout_long', index=10,
number=11, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='screen_round', full_name='aapt.pb.Configuration.screen_round', index=11,
number=12, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='wide_color_gamut', full_name='aapt.pb.Configuration.wide_color_gamut', index=12,
number=13, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='hdr', full_name='aapt.pb.Configuration.hdr', index=13,
number=14, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='orientation', full_name='aapt.pb.Configuration.orientation', index=14,
number=15, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='ui_mode_type', full_name='aapt.pb.Configuration.ui_mode_type', index=15,
number=16, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='ui_mode_night', full_name='aapt.pb.Configuration.ui_mode_night', index=16,
number=17, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='density', full_name='aapt.pb.Configuration.density', index=17,
number=18, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='touchscreen', full_name='aapt.pb.Configuration.touchscreen', index=18,
number=19, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='keys_hidden', full_name='aapt.pb.Configuration.keys_hidden', index=19,
number=20, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='keyboard', full_name='aapt.pb.Configuration.keyboard', index=20,
number=21, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='nav_hidden', full_name='aapt.pb.Configuration.nav_hidden', index=21,
number=22, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='navigation', full_name='aapt.pb.Configuration.navigation', index=22,
number=23, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='sdk_version', full_name='aapt.pb.Configuration.sdk_version', index=23,
number=24, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='product', full_name='aapt.pb.Configuration.product', index=24,
number=25, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
_CONFIGURATION_LAYOUTDIRECTION,
_CONFIGURATION_SCREENLAYOUTSIZE,
_CONFIGURATION_SCREENLAYOUTLONG,
_CONFIGURATION_SCREENROUND,
_CONFIGURATION_WIDECOLORGAMUT,
_CONFIGURATION_HDR,
_CONFIGURATION_ORIENTATION,
_CONFIGURATION_UIMODETYPE,
_CONFIGURATION_UIMODENIGHT,
_CONFIGURATION_TOUCHSCREEN,
_CONFIGURATION_KEYSHIDDEN,
_CONFIGURATION_KEYBOARD,
_CONFIGURATION_NAVHIDDEN,
_CONFIGURATION_NAVIGATION,
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=61,
serialized_end=2710,
)
_CONFIGURATION.fields_by_name['layout_direction'].enum_type = _CONFIGURATION_LAYOUTDIRECTION
_CONFIGURATION.fields_by_name['screen_layout_size'].enum_type = _CONFIGURATION_SCREENLAYOUTSIZE
_CONFIGURATION.fields_by_name['screen_layout_long'].enum_type = _CONFIGURATION_SCREENLAYOUTLONG
_CONFIGURATION.fields_by_name['screen_round'].enum_type = _CONFIGURATION_SCREENROUND
_CONFIGURATION.fields_by_name['wide_color_gamut'].enum_type = _CONFIGURATION_WIDECOLORGAMUT
_CONFIGURATION.fields_by_name['hdr'].enum_type = _CONFIGURATION_HDR
_CONFIGURATION.fields_by_name['orientation'].enum_type = _CONFIGURATION_ORIENTATION
_CONFIGURATION.fields_by_name['ui_mode_type'].enum_type = _CONFIGURATION_UIMODETYPE
_CONFIGURATION.fields_by_name['ui_mode_night'].enum_type = _CONFIGURATION_UIMODENIGHT
_CONFIGURATION.fields_by_name['touchscreen'].enum_type = _CONFIGURATION_TOUCHSCREEN
_CONFIGURATION.fields_by_name['keys_hidden'].enum_type = _CONFIGURATION_KEYSHIDDEN
_CONFIGURATION.fields_by_name['keyboard'].enum_type = _CONFIGURATION_KEYBOARD
_CONFIGURATION.fields_by_name['nav_hidden'].enum_type = _CONFIGURATION_NAVHIDDEN
_CONFIGURATION.fields_by_name['navigation'].enum_type = _CONFIGURATION_NAVIGATION
_CONFIGURATION_LAYOUTDIRECTION.containing_type = _CONFIGURATION
_CONFIGURATION_SCREENLAYOUTSIZE.containing_type = _CONFIGURATION
_CONFIGURATION_SCREENLAYOUTLONG.containing_type = _CONFIGURATION
_CONFIGURATION_SCREENROUND.containing_type = _CONFIGURATION
_CONFIGURATION_WIDECOLORGAMUT.containing_type = _CONFIGURATION
_CONFIGURATION_HDR.containing_type = _CONFIGURATION
_CONFIGURATION_ORIENTATION.containing_type = _CONFIGURATION
_CONFIGURATION_UIMODETYPE.containing_type = _CONFIGURATION
_CONFIGURATION_UIMODENIGHT.containing_type = _CONFIGURATION
_CONFIGURATION_TOUCHSCREEN.containing_type = _CONFIGURATION
_CONFIGURATION_KEYSHIDDEN.containing_type = _CONFIGURATION
_CONFIGURATION_KEYBOARD.containing_type = _CONFIGURATION
_CONFIGURATION_NAVHIDDEN.containing_type = _CONFIGURATION
_CONFIGURATION_NAVIGATION.containing_type = _CONFIGURATION
DESCRIPTOR.message_types_by_name['Configuration'] = _CONFIGURATION
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
Configuration = _reflection.GeneratedProtocolMessageType('Configuration', (_message.Message,), {
'DESCRIPTOR' : _CONFIGURATION,
'__module__' : 'frameworks.base.tools.aapt2.Configuration_pb2'
# @@protoc_insertion_point(class_scope:aapt.pb.Configuration)
})
_sym_db.RegisterMessage(Configuration)
DESCRIPTOR._options = None
# @@protoc_insertion_point(module_scope)

Просмотреть файл

@ -0,0 +1,13 @@
# Protos
These protos are generated from Resources.proto and Configuration.proto from the
Android repo. They are found in the frameworks/base/tools/aapt2/ directory. To
regenerate these if there are changes, run this command from the root of an
Android checkout:
protoc --python_out=some_dir frameworks/base/tools/aapt2/Resources.proto \
frameworks/base/tools/aapt2/Configuration.proto
Then copy the resulting \*pb2.py files from some_dir here. To make sure
Resources_pb2.py is able to import Configuration_pb2.py, remove the
"from frameworks.base.tools.aapt2" portion of the import statement so it will
instead be imported from the current directory.

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл