From 09e29779bbe55bb94b49ca87b504595e44616fec Mon Sep 17 00:00:00 2001 From: Justin Klaassen Date: Fri, 19 Jun 2015 13:09:27 -0700 Subject: Allow authority to be set from build configuration - DO NOT MERGE Bug: 22483271 Change-Id: I558c6d15316c9391ae57b96b7324ebdf1eddc29e (cherry picked from commit 1f460a3403aeb4d9a08341c6402096ab9f9eb244) --- Android.mk | 2 +- gen/com/android/deskclock/BuildConfig.java | 21 +++++++++++++++++++++ .../android/deskclock/provider/ClockContract.java | 4 +++- 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 gen/com/android/deskclock/BuildConfig.java diff --git a/Android.mk b/Android.mk index 9d0c7e4e4..e48b14c34 100644 --- a/Android.mk +++ b/Android.mk @@ -18,7 +18,7 @@ LOCAL_SDK_VERSION := current LOCAL_PACKAGE_NAME := DeskClock LOCAL_OVERRIDES_PACKAGES := AlarmClock -LOCAL_SRC_FILES := $(call all-java-files-under, src) +LOCAL_SRC_FILES := $(call all-java-files-under, src gen) LOCAL_STATIC_JAVA_LIBRARIES := android-opt-datetimepicker LOCAL_STATIC_JAVA_LIBRARIES += android-support-v13 diff --git a/gen/com/android/deskclock/BuildConfig.java b/gen/com/android/deskclock/BuildConfig.java new file mode 100644 index 000000000..861848f7d --- /dev/null +++ b/gen/com/android/deskclock/BuildConfig.java @@ -0,0 +1,21 @@ +/* + * 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.deskclock; + +public final class BuildConfig { + public static final String APPLICATION_ID = "com.android.deskclock"; +} diff --git a/src/com/android/deskclock/provider/ClockContract.java b/src/com/android/deskclock/provider/ClockContract.java index 20aed2aae..218f98474 100644 --- a/src/com/android/deskclock/provider/ClockContract.java +++ b/src/com/android/deskclock/provider/ClockContract.java @@ -18,6 +18,8 @@ package com.android.deskclock.provider; import android.net.Uri; import android.provider.BaseColumns; +import com.android.deskclock.BuildConfig; + /** *

* The contract between the clock provider and desk clock. Contains @@ -41,7 +43,7 @@ public final class ClockContract { * This authority is used for writing to or querying from the clock * provider. */ - public static final String AUTHORITY = "com.android.deskclock"; + public static final String AUTHORITY = BuildConfig.APPLICATION_ID; /** * This utility class cannot be instantiated -- cgit v1.2.3