diff options
author | Neil Fuller <nfuller@google.com> | 2015-03-31 11:15:39 +0100 |
---|---|---|
committer | Neil Fuller <nfuller@google.com> | 2015-03-31 11:15:39 +0100 |
commit | cea283535cfecc81565c07597d8db2674e76578a (patch) | |
tree | e1b048c36753cba67d7321eac1f661c6030ecbae | |
parent | b12dcfb1b12c13e01743567145f01e7d389afdbb (diff) | |
parent | 962a11ad5bf0cc88d40f416a4a0be6ab8d242ad7 (diff) | |
download | frameworks_base-cea283535cfecc81565c07597d8db2674e76578a.zip frameworks_base-cea283535cfecc81565c07597d8db2674e76578a.tar.gz frameworks_base-cea283535cfecc81565c07597d8db2674e76578a.tar.bz2 |
resolved conflicts for merge of 962a11ad to master
Change-Id: I8c6ac62d7267629c019997bb343d863aa56264eb
-rw-r--r-- | core/res/AndroidManifest.xml | 4 | ||||
-rw-r--r-- | services/core/Android.mk | 1 | ||||
-rw-r--r-- | services/core/java/com/android/server/updates/TZInfoInstallReceiver.java | 33 | ||||
-rw-r--r-- | services/core/java/com/android/server/updates/TzDataInstallReceiver.java | 54 |
4 files changed, 57 insertions, 35 deletions
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 0b1b807..3796c9c 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -3179,9 +3179,9 @@ </intent-filter> </receiver> - <receiver android:name="com.android.server.updates.TZInfoInstallReceiver" > + <receiver android:name="com.android.server.updates.TzDataInstallReceiver" > <intent-filter> - <action android:name="android.intent.action.UPDATE_TZINFO" /> + <action android:name="android.intent.action.UPDATE_TZDATA" /> <data android:scheme="content" android:host="*" android:mimeType="*/*" /> </intent-filter> </receiver> diff --git a/services/core/Android.mk b/services/core/Android.mk index 1a0fa34..64b6134 100644 --- a/services/core/Android.mk +++ b/services/core/Android.mk @@ -10,5 +10,6 @@ LOCAL_SRC_FILES += \ java/com/android/server/am/EventLogTags.logtags LOCAL_JAVA_LIBRARIES := telephony-common +LOCAL_STATIC_JAVA_LIBRARIES := tzdata_update include $(BUILD_STATIC_JAVA_LIBRARY) diff --git a/services/core/java/com/android/server/updates/TZInfoInstallReceiver.java b/services/core/java/com/android/server/updates/TZInfoInstallReceiver.java deleted file mode 100644 index 2fe68f8..0000000 --- a/services/core/java/com/android/server/updates/TZInfoInstallReceiver.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2013 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 com.android.server.updates; - -import android.util.Base64; - -import java.io.IOException; - -public class TZInfoInstallReceiver extends ConfigUpdateInstallReceiver { - - public TZInfoInstallReceiver() { - super("/data/misc/zoneinfo/", "tzdata", "metadata/", "version"); - } - - @Override - protected void install(byte[] encodedContent, int version) throws IOException { - super.install(Base64.decode(encodedContent, Base64.DEFAULT), version); - } -} diff --git a/services/core/java/com/android/server/updates/TzDataInstallReceiver.java b/services/core/java/com/android/server/updates/TzDataInstallReceiver.java new file mode 100644 index 0000000..b260e4e --- /dev/null +++ b/services/core/java/com/android/server/updates/TzDataInstallReceiver.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2015 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 com.android.server.updates; + +import android.util.Slog; + +import java.io.File; +import java.io.IOException; +import libcore.tzdata.update.TzDataBundleInstaller; + +/** + * An install receiver responsible for installing timezone data updates. + */ +public class TzDataInstallReceiver extends ConfigUpdateInstallReceiver { + + private static final String TAG = "TZDataInstallReceiver"; + + private static final File TZ_DATA_DIR = new File("/data/misc/zoneinfo"); + private static final String UPDATE_DIR_NAME = TZ_DATA_DIR.getPath() + "/updates/"; + private static final String UPDATE_METADATA_DIR_NAME = "metadata/"; + private static final String UPDATE_VERSION_FILE_NAME = "version"; + private static final String UPDATE_CONTENT_FILE_NAME = "tzdata_bundle.zip"; + + private final TzDataBundleInstaller installer; + + public TzDataInstallReceiver() { + super(UPDATE_DIR_NAME, UPDATE_CONTENT_FILE_NAME, UPDATE_METADATA_DIR_NAME, + UPDATE_VERSION_FILE_NAME); + installer = new TzDataBundleInstaller(TAG, TZ_DATA_DIR); + } + + @Override + protected void install(byte[] content, int version) throws IOException { + boolean valid = installer.install(content); + Slog.i(TAG, "Timezone data install valid for this device: " + valid); + // Even if !valid, we call super.install(). Only in the event of an exception should we + // not. If we didn't do this we could attempt to install repeatedly. + super.install(content, version); + } +} |