Skip to content
Snippets Groups Projects
Commit 84c56bd0 authored by Neil Fuller's avatar Neil Fuller
Browse files

Multiple improvements/extensions for TimeZoneData

This change rearranges the testing dir structure to
be more hierarchical to enable a distinction between
test data and xTS test code.

The testing/ disto.zip files have been moved under
the output_data dir to match the structure found in
system/timezone.

This change also adds the oem_template directory that
can be used to bootstrap OEMs' own time zone data apps
and tests:

1) Moved the "demo" app files to be under under
oem_template/data_app.
2) Added an xTS test class / host library that can be used
in OEM-specific test suites by OEMs to make sure they have
integrated the time zone updates correctly.

Test: Manual
Test: make droid
Bug: 31008728

Change-Id: Ia4d4dc12647263acb4602cfcb1aa4f11026072f1
parent 872c1e1a
No related branches found
No related tags found
No related merge requests found
Showing
with 320 additions and 70 deletions
......@@ -15,7 +15,7 @@
LOCAL_PATH:= $(call my-dir)
# A static library containing all the source needed by a TimeZoneDataApp.
# A static library containing all the source needed by a Time Zone Data app.
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := time_zone_distro_provider
......@@ -25,24 +25,4 @@ LOCAL_PROGUARD_FLAG_FILES := $(LOCAL_PATH)/proguard.cfg
LOCAL_STATIC_JAVA_LIBRARIES := time_zone_distro
include $(BUILD_STATIC_JAVA_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_PACKAGE_NAME := DemoTimeZoneDataApp
LOCAL_MANIFEST_FILE := manifests/install/AndroidManifest.xml
LOCAL_ASSET_DIR := system/timezone/output_data/distro
LOCAL_AAPT_FLAGS := --version-code 10 --version-name system_image
LOCAL_STATIC_JAVA_LIBRARIES := time_zone_distro_provider
include $(BUILD_PACKAGE)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_PACKAGE_NAME := DemoTimeZoneDataApp_data
LOCAL_MANIFEST_FILE := manifests/install/AndroidManifest.xml
LOCAL_ASSET_DIR := system/timezone/output_data/distro
LOCAL_AAPT_FLAGS := --version-code 20 --version-name installable
# Needed to ensure the .apk can be installed. Without it the .apk is missing a .dex.
LOCAL_DEX_PREOPT := false
LOCAL_STATIC_JAVA_LIBRARIES := time_zone_distro_provider
include $(BUILD_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
README 0 → 100644
This directory contains code associated with the "Time Zone Data" app, which is a mechanism
for updating time zone rules data on device without needing a full OTA: it is delivered via
OEM-specific signed .apk files.
The code/files beneath this directory are maintained by Android developers and intended to be
OEM-independent.
See the oem_template directory for files / directory structures that OEMs are expected to copy
elsewhere and configure.
......@@ -14,9 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.timezone.data.base">
package="com.android.timezone.data.placeholder_for_aapt_override">
<application
android:allowBackup="false"
......
......@@ -14,9 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.timezone.data.base">
package="com.android.timezone.data.placeholder_for_aapt_override">
<application
android:allowBackup="false"
......
This directory contains an example / suggested structure for OEMs.
Contained within is code for implementing the time zone update feature.
OEMs are expected to copy the sub-dirs under this directory to appropriate places in their own repos
and customize.
Further instructions for OEMs can be found by searching for the string "OEM-INSTRUCTION" in the files
beneath this directory.
# Copyright (C) 2017 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.
# Targets for creating the real signed versions of the time zone data app.
LOCAL_PATH := $(call my-dir)
OEM_APP_PATH := $(LOCAL_PATH)
# Target to build the "real" time zone data app.
include $(CLEAR_VARS)
LOCAL_ASSET_DIR := system/timezone/output_data/distro
TIME_ZONE_DATA_APP_SUFFIX :=
# OEM-INSTRUCTION: OEMs should come up with a suitable versioning strategy.
TIME_ZONE_DATA_APP_VERSION_CODE := 10
TIME_ZONE_DATA_APP_VERSION_NAME := 10
include $(OEM_APP_PATH)/build_oem_data_app.mk
include $(call all-makefiles-under,$(LOCAL_PATH))
This file originates from package/apps/TimeZoneData/oem_template/data_app.
OEM-INSTRUCTION See below for the purpose of this directory and changes OEMs must make.
This directory contains a suggested structure for building an OEM version of Time Zone Data app
(real and test versions).
e.g. You can copy it
cp -r data_app ${ANDROID_BUILD_TOP}/vendor/oemcorp/apps/TimeZoneDataOemCorp
Where <oemcorp> is your company name.
...then read / change all the things marked with OEM-INSTRUCTION.
\ No newline at end of file
# Copyright (C) 2017 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.
#
# An .mk include file that contains the boilerplate needed to build real and
# test, OEM-specific Time Zone Data apps.
#
# Users should set:
# OEM_APP_PATH - the location of the OEM directory for the app, e.g. one that
# contains the app res/ dir.
# TIME_ZONE_DATA_APP_SUFFIX - the suffix to apply to the package name. Can be
# empty, or contain things like _test1 for test .apk files.
# TIME_ZONE_DATA_APP_VERSION_CODE - the version code for the .apk
# TIME_ZONE_DATA_APP_VERSION_NAME - the version name for the .apk
#
LOCAL_MODULE_TAGS := optional
# All src comes from an AOSP static library.
LOCAL_STATIC_JAVA_LIBRARIES := time_zone_distro_provider
# All resources come from the vendor-specific dirs.
LOCAL_RESOURCE_DIR := $(OEM_APP_PATH)/res
LOCAL_FULL_MANIFEST_FILE := packages/apps/TimeZoneData/manifests/install/AndroidManifest.xml
LOCAL_PACKAGE_NAME := TimeZoneData$(TIME_ZONE_DATA_APP_SUFFIX)
LOCAL_AAPT_FLAGS := --version-code $(TIME_ZONE_DATA_APP_VERSION_CODE) \
--version-name $(TIME_ZONE_DATA_APP_VERSION_NAME)
# OEM-INSTRUCTION: Modify the name, s/oemcorp/<Your company name>/
LOCAL_AAPT_FLAGS += --rename-manifest-package com.oemcorp.android.timezone.data
# OEM-INSTRUCTION: Modify the name, s/oemcorp/<Your company name>/
LOCAL_MODULE_OWNER := oemcorp
LOCAL_PRIVILEGED_MODULE := true
# OEM-INSTRUCTION: Configure your own certificate.
LOCAL_CERTIFICATE :=
include $(BUILD_PACKAGE)
......@@ -16,5 +16,8 @@
-->
<resources>
<string name="app_name">Time Zone Data Demo App</string>
<!-- OEM-INSTRUCTION: Modify the name. This will appear in Settings / apps and app stores.
OEMs will usually want to provide translations too.
-->
<string name="app_name">OEM Corp Time Zone Data</string>
</resources>
# Copyright (C) 2017 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.
# Targets for creating signed test versions of the time zone data app that can be used for
# manual testing and / or xts-type tests.
LOCAL_PATH := $(call my-dir)
# The location of the "real" app.
OEM_APP_PATH := $(LOCAL_PATH)/..
# Paths used to find files shared with AOSP.
aosp_test_data_path := packages/apps/TimeZoneData/testing/data
# Target to build the "test 1" time zone data app.
include $(CLEAR_VARS)
LOCAL_ASSET_DIR := $(aosp_test_data_path)/test1/output_data/distro
TIME_ZONE_DATA_APP_SUFFIX := _test1
# OEM-INSTRUCTION: OEMs should come up with a suitable versioning strategy and this version should
# be guaranteed newer than the "real" app.
TIME_ZONE_DATA_APP_VERSION_CODE := 15
TIME_ZONE_DATA_APP_VERSION_NAME := test1
# When built, explicitly put it in the data partition since this is for tests, not the system image.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
include $(OEM_APP_PATH)/build_oem_data_app.mk
# Target to build the "test 2" time zone data app.
include $(CLEAR_VARS)
LOCAL_ASSET_DIR := $(aosp_test_data_path)/test2/output_data/distro
TIME_ZONE_DATA_APP_SUFFIX := _test2
# OEM-INSTRUCTION: OEMs should come up with a suitable versioning strategy and this version should
# be guaranteed newer than the "real" app.
TIME_ZONE_DATA_APP_VERSION_CODE := 20
TIME_ZONE_DATA_APP_VERSION_NAME := test2
# When built, explicitly put it in the data partition since this is for tests, not the system image.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
include $(OEM_APP_PATH)/build_oem_data_app.mk
# Tidy up variables.
aosp_test_data_path :=
\ No newline at end of file
# Copyright (C) 2017 Google Inc.
#
# 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.
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
# OEM-INSTRUCTION: OEMs should change this.
LOCAL_COMPATIBILITY_SUITE := xts
# OEM-INSTRUCTION: OEMs should change this
LOCAL_MODULE := XtsTimeZoneTestCases
LOCAL_STATIC_JAVA_LIBRARIES := time_zone_data_app_testing
# Embed the .apk files needed by the tests as resources.
EMBED_APK_MODULE_NAME := TimeZoneData_test1
include $(LOCAL_PATH)/embed_apk_as_resource.mk
EMBED_APK_MODULE_NAME := TimeZoneData_test2
include $(LOCAL_PATH)/embed_apk_as_resource.mk
include $(BUILD_HOST_JAVA_LIBRARY)
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2017 Google Inc.
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.
-->
<configuration description="Config for PTS Time Zone test cases">
<test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
<!-- OEM-INSTRUCTION: Change this to match the target name in Android.mk -->
<option name="jar" value="XtsTimeZoneTestCases.jar" />
<!-- OEM-INSTRUCTION: Change this to match the package name of the data app -->
<option name="set-option" value="oem-data-app-package-name:com.oemcorp.android.timezone.data" />
<option name="set-option" value="oem-data-app-apk-prefix:TimeZoneData" />
</test>
</configuration>
This file originates from package/apps/TimeZoneData/oem_template/xts.
OEM-INSTRUCTION See below for the purpose of this directory and changes to make.
This directory contains a suggested structure for CTS-like host-side tests for checking the default
time zone update feature has been integrated properly.
These tests are not CTS tests because the OEM must perform their own integration and provide their
own OEM-specific signed time zone data app implementation under their own package.
# Copyright (C) 2017 Google Inc.
#
# 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.
# An .mk inclusion file that adds a .apk to a java library target as a resource.
#
# Inputs:
# LOCAL_MODULE should be set before including this file.
# EMBED_APK_MODULE_NAME - the name of the BUILD_PACKAGE MODULE_NAME to be included.
#
# Outputs:
# The dependencies for the required .apk are configured.
# LOCAL_JAVA_RESOURCE_FILES is extended to include the .apk.
# Location of the package.apk file we want.
embed_apk_package := $(call intermediates-dir-for, APPS, $(EMBED_APK_MODULE_NAME))/package.apk
# Location to copy the package.apk.
embed_container_intermediates := $(call intermediates-dir-for, JAVA_LIBRARIES, $(LOCAL_MODULE))
embed_res_dir := $(embed_container_intermediates)/embed_$(EMBED_APK_MODULE_NAME)_res
embed_res_file := $(embed_res_dir)/$(EMBED_APK_MODULE_NAME)$(COMMON_ANDROID_PACKAGE_SUFFIX)
# Copy the files / establish the dependency on the .apk.
$(embed_res_file) : PRIVATE_RES_FILE := $(embed_res_file)
$(embed_res_file) : $(embed_apk_package)
@echo "Embed apk into $(LOCAL_MODULE)"
$(hide) rm -rf $(dir $(PRIVATE_RES_FILE))
$(hide) mkdir -p $(dir $(PRIVATE_RES_FILE))
$(hide) cp $< $(PRIVATE_RES_FILE)
LOCAL_JAVA_RESOURCE_FILES += $(embed_res_file)
# Tidy up variables.
embed_apk_package :=
embed_res_dir :=
embed_res_file :=
\ No newline at end of file
......@@ -14,42 +14,4 @@
LOCAL_PATH:= $(call my-dir)
TIME_ZONE_DATA_APP_DIR := $(LOCAL_PATH)/..
# Test 1
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_PACKAGE_NAME := DemoTimeZoneDataApp_test1
LOCAL_FULL_MANIFEST_FILE := $(TIME_ZONE_DATA_APP_DIR)/manifests/install/AndroidManifest.xml
LOCAL_RESOURCE_DIR := $(TIME_ZONE_DATA_APP_DIR)/res
LOCAL_ASSET_DIR := $(LOCAL_PATH)/test1/distro
LOCAL_AAPT_FLAGS := --version-code 30 --version-name test1
# Needed to ensure the .apk can be installed. Without it the .apk is missing a .dex.
LOCAL_DEX_PREOPT := false
LOCAL_STATIC_JAVA_LIBRARIES := time_zone_distro_provider
include $(BUILD_PACKAGE)
# Test 2
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_PACKAGE_NAME := DemoTimeZoneDataApp_test2
LOCAL_FULL_MANIFEST_FILE := $(TIME_ZONE_DATA_APP_DIR)/manifests/install/AndroidManifest.xml
LOCAL_RESOURCE_DIR := $(TIME_ZONE_DATA_APP_DIR)/res
LOCAL_ASSET_DIR := $(LOCAL_PATH)/test2/distro
LOCAL_AAPT_FLAGS := --version-code 40 --version-name test2
# Needed to ensure the .apk can be installed. Without it the .apk is missing a .dex.
LOCAL_DEX_PREOPT := false
LOCAL_STATIC_JAVA_LIBRARIES := time_zone_distro_provider
include $(BUILD_PACKAGE)
# Test 3
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_PACKAGE_NAME := DemoTimeZoneDataApp_test3
LOCAL_FULL_MANIFEST_FILE := $(TIME_ZONE_DATA_APP_DIR)/manifests/uninstall/AndroidManifest.xml
LOCAL_RESOURCE_DIR := $(TIME_ZONE_DATA_APP_DIR)/res
LOCAL_AAPT_FLAGS := --version-code 50 --version-name test3
# Needed to ensure the .apk can be installed. Without it the .apk is missing a .dex.
LOCAL_DEX_PREOPT := false
LOCAL_STATIC_JAVA_LIBRARIES := time_zone_distro_provider
include $(BUILD_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
\ No newline at end of file
This directory contains files associated with testing the Time Zone update feature.
data/ - Test data files and scripts for generating that data.
xts/ - Libraries to support automated testing of the Time Zone update feature.
#!/usr/bin/env bash
#
# Copyright (C) 2017 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.
#
# Updates the test data files.
TIMEZONE_DIR=${ANDROID_BUILD_TOP}/system/timezone
DISTRO_TOOLS_DIR=${TIMEZONE_DIR}/distro/tools
......@@ -16,30 +30,30 @@ TEST_DIR=test1
./transform-distro-files.sh ${REFERENCE_DISTRO_FILES} ${IANA_VERSION} ./${TEST_DIR}/output_data
# Create the distro .zip
mkdir -p ${TEST_DIR}/distro
mkdir -p ${TEST_DIR}/output_data/distro
${DISTRO_TOOLS_DIR}/create-distro.py \
-iana_version ${IANA_VERSION} \
-revision 1 \
-tzdata ${TEST_DIR}/output_data/iana/tzdata \
-icu ${TEST_DIR}/output_data/icu_overlay/icu_tzdata.dat \
-tzlookup ${TEST_DIR}/output_data/android/tzlookup.xml \
-output ${TEST_DIR}/distro
-output ${TEST_DIR}/output_data/distro
# Test 2: A set of data older than the system-image data from ${TIMEZONE_DIR}
IANA_VERSION=2016a
TEST_DIR=test2
# Create fake distro input files.
./fabricate-distro-files.sh ${REFERENCE_DISTRO_FILES} ${IANA_VERSION} ./${TEST_DIR}/output_data
./transform-distro-files.sh ${REFERENCE_DISTRO_FILES} ${IANA_VERSION} ./${TEST_DIR}/output_data
# Create the distro .zip
mkdir -p ${TEST_DIR}/distro
mkdir -p ${TEST_DIR}/output_data/distro
${DISTRO_TOOLS_DIR}/create-distro.py \
-iana_version ${IANA_VERSION} \
-revision 1 \
-tzdata ${TEST_DIR}/output_data/iana/tzdata \
-icu ${TEST_DIR}/output_data/icu_overlay/icu_tzdata.dat \
-tzlookup ${TEST_DIR}/output_data/android/tzlookup.xml \
-output ${TEST_DIR}/distro
-output ${TEST_DIR}/output_data/distro
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment