Create the stubs lib for com.android.location.provider

com.android.location.provider.stubs is the stubs library for the shared
library com.android.location.provider. The stubs library is intended to
provide the stable set of APIs to the apps implementing location
provider.

Without the stubs library, apps had to directly link to the shared
library which is built without Android SDK and exposes private APIs that
are not intended to be used by apps. This also has been causing the
lin-type check warnings when the shared lib is used by apps built with
SDK; apps built with SDK is not allowed to link to lib built without
SDK. This has been reported as warnings but will soon be errors. Now
such apps are required to link to the stubs lib, which is built with
SDK.

While building the stubs library, following APIs are made hidden because
they are exposing private APIs from the Android platform.

1) Activity* classes are removed from the API, as they are not intended
to be used by apps since O.
2) GeocodeProvider and GeofenceProvider are removed from the API.
3) LocationProvider.mLocationManager is removed as it is exposing the
private symbol ILocationProvider
4) ProviderPropertiesUnbundle.getProviderProperties are removed from the
API as it is exposing the private symbol ProviderProperties.
5) The constructor of ProviderRequestUnbundled is removed since the
class is intended to be instantiated by the service.

Bug: 71420593
Test: m -j com.android.location.provider.stubs

Change-Id: I20aba7e9ca9c3adc75db241f37a55f0d657f3ced
This commit is contained in:
Jiyong Park
2018-02-27 22:00:23 +09:00
parent 790befca1d
commit eee99986c8
12 changed files with 33 additions and 1 deletions

View File

@@ -42,3 +42,25 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)
# ==== Stub library ===========================================
include $(CLEAR_VARS)
LOCAL_MODULE := com.android.location.provider-stubs-gen
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_SRC_FILES := $(call all-java-files-under,java)
LOCAL_DROIDDOC_STUB_OUT_DIR := $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/com.android.location.provider.stubs_intermediates/src
LOCAL_DROIDDOC_OPTIONS:= \
-hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 \
-stubpackages com.android.location.provider \
-nodocs
LOCAL_UNINSTALLABLE_MODULE := true
include $(BUILD_DROIDDOC)
com_android_nfc_extras_gen_stamp := $(full_target)
include $(CLEAR_VARS)
LOCAL_MODULE := com.android.location.provider.stubs
LOCAL_SOURCE_FILES_ALL_GENERATED := true
LOCAL_SDK_VERSION := current
LOCAL_ADDITIONAL_DEPENDENCIES := $(com_android_nfc_extras_gen_stamp)
com_android_nfc_extras_gen_stamp :=
include $(BUILD_STATIC_JAVA_LIBRARY)

View File

@@ -23,6 +23,7 @@ import java.util.List;
/**
* A class representing an event for Activity changes.
* @hide
*/
public class ActivityChangedEvent {
private final List<ActivityRecognitionEvent> mActivityRecognitionEvents;

View File

@@ -18,6 +18,7 @@ package com.android.location.provider;
/**
* A class that represents an Activity Recognition Event.
* @hide
*/
public class ActivityRecognitionEvent {
private final String mActivity;

View File

@@ -28,6 +28,7 @@ import java.util.HashSet;
/**
* A class that exposes {@link IActivityRecognitionHardware} functionality to unbundled services.
* @hide
*/
public final class ActivityRecognitionProvider {
private final IActivityRecognitionHardware mService;

View File

@@ -27,6 +27,7 @@ import android.util.Log;
/**
* A client class for interaction with an Activity-Recognition provider.
* @hide
*/
public abstract class ActivityRecognitionProviderClient {
private static final String TAG = "ArProviderClient";

View File

@@ -30,6 +30,7 @@ import android.util.Log;
* A watcher class for Activity-Recognition instances.
*
* @deprecated use {@link ActivityRecognitionProviderClient} instead.
* @hide
*/
@Deprecated
public class ActivityRecognitionProviderWatcher {

View File

@@ -33,6 +33,7 @@ import java.util.List;
* <p>IMPORTANT: This class is effectively a public API for unbundled
* applications, and must remain API stable. See README.txt in the root
* of this package for more information.
* @hide
*/
public abstract class GeocodeProvider {

View File

@@ -31,6 +31,7 @@ import android.location.IGeofenceProvider;
* <p>IMPORTANT: This class is effectively a public API for unbundled
* applications, and must remain API stable. See README.txt in the root
* of this package for more information.
* @hide
*/
public abstract class GeofenceProvider {

View File

@@ -105,7 +105,7 @@ public class GmsFusedBatchOptions {
* Method definitions for internal use.
*/
/*
/**
* @hide
*/
public FusedBatchOptions getParcelableOptions() {

View File

@@ -56,6 +56,7 @@ import com.android.internal.util.FastPrintWriter;
public abstract class LocationProviderBase {
private final String TAG;
/** @hide */
protected final ILocationManager mLocationManager;
private final ProviderProperties mProperties;
private final IBinder mBinder;

View File

@@ -41,6 +41,7 @@ public final class ProviderPropertiesUnbundled {
mProperties = properties;
}
/** @hide */
public ProviderProperties getProviderProperties() {
return mProperties;
}

View File

@@ -33,6 +33,7 @@ import com.android.internal.location.ProviderRequest;
public final class ProviderRequestUnbundled {
private final ProviderRequest mRequest;
/** @hide */
public ProviderRequestUnbundled(ProviderRequest request) {
mRequest = request;
}