Loading core/res/AndroidManifest.xml +2 −2 Original line number Diff line number Diff line Loading @@ -3098,9 +3098,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> Loading services/core/Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -10,5 +10,6 @@ LOCAL_SRC_FILES += \ java/com/android/server/am/EventLogTags.logtags LOCAL_JAVA_LIBRARIES := android.policy telephony-common LOCAL_STATIC_JAVA_LIBRARIES := tzdata_update include $(BUILD_STATIC_JAVA_LIBRARY) services/core/java/com/android/server/updates/TZInfoInstallReceiver.java→services/core/java/com/android/server/updates/TzDataInstallReceiver.java +54 −0 Original line number Diff line number Diff line /* * Copyright (C) 2013 The Android Open Source Project * 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. Loading @@ -16,18 +16,39 @@ package com.android.server.updates; import android.util.Base64; import android.util.Slog; import java.io.File; import java.io.IOException; import libcore.tzdata.update.TzDataBundleInstaller; public class TZInfoInstallReceiver extends ConfigUpdateInstallReceiver { /** * 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 TZInfoInstallReceiver() { super("/data/misc/zoneinfo/", "tzdata", "metadata/", "version"); 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[] encodedContent, int version) throws IOException { super.install(Base64.decode(encodedContent, Base64.DEFAULT), version); 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); } } Loading
core/res/AndroidManifest.xml +2 −2 Original line number Diff line number Diff line Loading @@ -3098,9 +3098,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> Loading
services/core/Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -10,5 +10,6 @@ LOCAL_SRC_FILES += \ java/com/android/server/am/EventLogTags.logtags LOCAL_JAVA_LIBRARIES := android.policy telephony-common LOCAL_STATIC_JAVA_LIBRARIES := tzdata_update include $(BUILD_STATIC_JAVA_LIBRARY)
services/core/java/com/android/server/updates/TZInfoInstallReceiver.java→services/core/java/com/android/server/updates/TzDataInstallReceiver.java +54 −0 Original line number Diff line number Diff line /* * Copyright (C) 2013 The Android Open Source Project * 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. Loading @@ -16,18 +16,39 @@ package com.android.server.updates; import android.util.Base64; import android.util.Slog; import java.io.File; import java.io.IOException; import libcore.tzdata.update.TzDataBundleInstaller; public class TZInfoInstallReceiver extends ConfigUpdateInstallReceiver { /** * 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 TZInfoInstallReceiver() { super("/data/misc/zoneinfo/", "tzdata", "metadata/", "version"); 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[] encodedContent, int version) throws IOException { super.install(Base64.decode(encodedContent, Base64.DEFAULT), version); 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); } }