diff --git a/Android.bp b/Android.bp index aac95cc59b4ed..f032e6287d893 100644 --- a/Android.bp +++ b/Android.bp @@ -191,10 +191,6 @@ java_defaults { "core/java/android/hardware/input/IInputDevicesChangedListener.aidl", "core/java/android/hardware/input/ITabletModeChangedListener.aidl", "core/java/android/hardware/iris/IIrisService.aidl", - "core/java/android/hardware/location/IActivityRecognitionHardware.aidl", - "core/java/android/hardware/location/IActivityRecognitionHardwareClient.aidl", - "core/java/android/hardware/location/IActivityRecognitionHardwareSink.aidl", - "core/java/android/hardware/location/IActivityRecognitionHardwareWatcher.aidl", "core/java/android/hardware/location/IGeofenceHardware.aidl", "core/java/android/hardware/location/IGeofenceHardwareCallback.aidl", "core/java/android/hardware/location/IGeofenceHardwareMonitorCallback.aidl", diff --git a/config/boot-image-profile.txt b/config/boot-image-profile.txt index c2e441b35f485..3ec0db4d99ce4 100644 --- a/config/boot-image-profile.txt +++ b/config/boot-image-profile.txt @@ -2768,11 +2768,6 @@ HPLandroid/hardware/location/GeofenceHardwareService$1;->getStatusOfMonitoringTy HPLandroid/hardware/location/GeofenceHardwareService$1;->registerForMonitorStateChangeCallback(ILandroid/hardware/location/IGeofenceHardwareMonitorCallback;)Z HPLandroid/hardware/location/GeofenceHardwareService$1;->removeGeofence(II)Z HPLandroid/hardware/location/GeofenceHardwareService;->checkPermission(III)V -HPLandroid/hardware/location/IActivityRecognitionHardwareClient$Stub$Proxy;->onAvailabilityChanged(ZLandroid/hardware/location/IActivityRecognitionHardware;)V -HPLandroid/hardware/location/IActivityRecognitionHardwareClient$Stub;->()V -HPLandroid/hardware/location/IActivityRecognitionHardwareClient$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/location/IActivityRecognitionHardwareClient; -HPLandroid/hardware/location/IActivityRecognitionHardwareClient$Stub;->onTransact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z -HPLandroid/hardware/location/IActivityRecognitionHardwareClient;->onAvailabilityChanged(ZLandroid/hardware/location/IActivityRecognitionHardware;)V HPLandroid/hardware/location/IContextHubCallback$Stub;->asBinder()Landroid/os/IBinder; HPLandroid/hardware/location/IContextHubCallback$Stub;->onTransact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z HPLandroid/hardware/location/IContextHubService$Stub$Proxy;->findNanoAppOnHub(ILandroid/hardware/location/NanoAppFilter;)[I @@ -21782,7 +21777,6 @@ HSPLandroid/hardware/input/KeyboardLayout$1;->()V HSPLandroid/hardware/input/TouchCalibration$1;->()V HSPLandroid/hardware/input/TouchCalibration;->()V HSPLandroid/hardware/input/TouchCalibration;->getAffineTransform()[F -HSPLandroid/hardware/location/ActivityRecognitionHardware;->isSupported()Z HSPLandroid/hardware/location/ContextHubInfo$1;->()V HSPLandroid/hardware/location/ContextHubInfo;->(Landroid/hardware/contexthub/V1_0/ContextHub;)V HSPLandroid/hardware/location/ContextHubMessage$1;->()V @@ -21802,13 +21796,6 @@ HSPLandroid/hardware/location/GeofenceHardwareService$1;->setGpsGeofenceHardware HSPLandroid/hardware/location/GeofenceHardwareService;->()V HSPLandroid/hardware/location/GeofenceHardwareService;->onBind(Landroid/content/Intent;)Landroid/os/IBinder; HSPLandroid/hardware/location/GeofenceHardwareService;->onCreate()V -HSPLandroid/hardware/location/IActivityRecognitionHardware;->disableActivityEvent(Ljava/lang/String;I)Z -HSPLandroid/hardware/location/IActivityRecognitionHardware;->enableActivityEvent(Ljava/lang/String;IJ)Z -HSPLandroid/hardware/location/IActivityRecognitionHardware;->flush()Z -HSPLandroid/hardware/location/IActivityRecognitionHardware;->getSupportedActivities()[Ljava/lang/String; -HSPLandroid/hardware/location/IActivityRecognitionHardware;->isActivitySupported(Ljava/lang/String;)Z -HSPLandroid/hardware/location/IActivityRecognitionHardware;->registerSink(Landroid/hardware/location/IActivityRecognitionHardwareSink;)Z -HSPLandroid/hardware/location/IActivityRecognitionHardware;->unregisterSink(Landroid/hardware/location/IActivityRecognitionHardwareSink;)Z HSPLandroid/hardware/location/IContextHubCallback$Stub$Proxy;->asBinder()Landroid/os/IBinder; HSPLandroid/hardware/location/IContextHubCallback$Stub$Proxy;->onMessageReceipt(IILandroid/hardware/location/ContextHubMessage;)V HSPLandroid/hardware/location/IContextHubCallback;->onMessageReceipt(IILandroid/hardware/location/ContextHubMessage;)V @@ -55650,7 +55637,6 @@ Landroid/hardware/input/InputManagerInternal; Landroid/hardware/input/KeyboardLayout$1; Landroid/hardware/input/TouchCalibration$1; Landroid/hardware/input/TouchCalibration; -Landroid/hardware/location/ActivityRecognitionHardware; Landroid/hardware/location/ContextHubInfo$1; Landroid/hardware/location/ContextHubInfo; Landroid/hardware/location/ContextHubManager; @@ -55666,11 +55652,6 @@ Landroid/hardware/location/GeofenceHardwareMonitorEvent; Landroid/hardware/location/GeofenceHardwareRequestParcelable$1; Landroid/hardware/location/GeofenceHardwareService$1; Landroid/hardware/location/GeofenceHardwareService; -Landroid/hardware/location/IActivityRecognitionHardware$Stub; -Landroid/hardware/location/IActivityRecognitionHardware; -Landroid/hardware/location/IActivityRecognitionHardwareClient$Stub$Proxy; -Landroid/hardware/location/IActivityRecognitionHardwareClient$Stub; -Landroid/hardware/location/IActivityRecognitionHardwareClient; Landroid/hardware/location/IContextHubCallback$Stub$Proxy; Landroid/hardware/location/IContextHubCallback; Landroid/hardware/location/IContextHubClient$Stub; diff --git a/config/hiddenapi-greylist.txt b/config/hiddenapi-greylist.txt index 02eff0b6cee26..13f8dd924d4a9 100644 --- a/config/hiddenapi-greylist.txt +++ b/config/hiddenapi-greylist.txt @@ -462,8 +462,6 @@ Landroid/hardware/input/IInputManager$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/hardware/input/IInputManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/input/IInputManager; Landroid/hardware/input/IInputManager$Stub;->TRANSACTION_injectInputEvent:I Landroid/hardware/input/IInputManager;->injectInputEvent(Landroid/view/InputEvent;I)Z -Landroid/hardware/location/IActivityRecognitionHardwareClient$Stub;->()V -Landroid/hardware/location/IActivityRecognitionHardwareClient;->onAvailabilityChanged(ZLandroid/hardware/location/IActivityRecognitionHardware;)V Landroid/hardware/location/IContextHubService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/location/IContextHubService; Landroid/hardware/usb/IUsbManager$Stub$Proxy;->(Landroid/os/IBinder;)V Landroid/hardware/usb/IUsbManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/usb/IUsbManager; diff --git a/config/preloaded-classes b/config/preloaded-classes index c8a2a9c19b28f..cd798adf5d446 100644 --- a/config/preloaded-classes +++ b/config/preloaded-classes @@ -1405,10 +1405,7 @@ android.hardware.input.InputManager android.hardware.input.InputManager$InputDeviceListener android.hardware.input.InputManager$InputDeviceListenerDelegate android.hardware.input.InputManager$InputDevicesChangedListener -android.hardware.location.ActivityRecognitionHardware android.hardware.location.ContextHubManager -android.hardware.location.IActivityRecognitionHardware -android.hardware.location.IActivityRecognitionHardware$Stub android.hardware.radio.RadioManager android.hardware.soundtrigger.SoundTrigger android.hardware.soundtrigger.SoundTrigger$ConfidenceLevel diff --git a/core/java/android/hardware/location/ActivityChangedEvent.aidl b/core/java/android/hardware/location/ActivityChangedEvent.aidl deleted file mode 100644 index 21f24459ac85b..0000000000000 --- a/core/java/android/hardware/location/ActivityChangedEvent.aidl +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2014 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 android.hardware.location; - -parcelable ActivityChangedEvent; \ No newline at end of file diff --git a/core/java/android/hardware/location/ActivityChangedEvent.java b/core/java/android/hardware/location/ActivityChangedEvent.java deleted file mode 100644 index 16cfe6e23e889..0000000000000 --- a/core/java/android/hardware/location/ActivityChangedEvent.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2014 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 android.hardware.location; - -import android.annotation.NonNull; -import android.os.Parcel; -import android.os.Parcelable; - -import java.security.InvalidParameterException; -import java.util.Arrays; -import java.util.List; - -/** - * A class representing an event for Activity changes. - * - * @hide - */ -public class ActivityChangedEvent implements Parcelable { - private final List mActivityRecognitionEvents; - - public ActivityChangedEvent(ActivityRecognitionEvent[] activityRecognitionEvents) { - if (activityRecognitionEvents == null) { - throw new InvalidParameterException( - "Parameter 'activityRecognitionEvents' must not be null."); - } - - mActivityRecognitionEvents = Arrays.asList(activityRecognitionEvents); - } - - @NonNull - public Iterable getActivityRecognitionEvents() { - return mActivityRecognitionEvents; - } - - public static final Creator CREATOR = - new Creator() { - @Override - public ActivityChangedEvent createFromParcel(Parcel source) { - int activityRecognitionEventsLength = source.readInt(); - ActivityRecognitionEvent[] activityRecognitionEvents = - new ActivityRecognitionEvent[activityRecognitionEventsLength]; - source.readTypedArray(activityRecognitionEvents, ActivityRecognitionEvent.CREATOR); - - return new ActivityChangedEvent(activityRecognitionEvents); - } - - @Override - public ActivityChangedEvent[] newArray(int size) { - return new ActivityChangedEvent[size]; - } - }; - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel parcel, int flags) { - ActivityRecognitionEvent[] activityRecognitionEventArray = - mActivityRecognitionEvents.toArray(new ActivityRecognitionEvent[0]); - parcel.writeInt(activityRecognitionEventArray.length); - parcel.writeTypedArray(activityRecognitionEventArray, flags); - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder("[ ActivityChangedEvent:"); - - for (ActivityRecognitionEvent event : mActivityRecognitionEvents) { - builder.append("\n "); - builder.append(event.toString()); - } - builder.append("\n]"); - - return builder.toString(); - } -} diff --git a/core/java/android/hardware/location/ActivityRecognitionEvent.java b/core/java/android/hardware/location/ActivityRecognitionEvent.java deleted file mode 100644 index 190030a82d6bb..0000000000000 --- a/core/java/android/hardware/location/ActivityRecognitionEvent.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2014 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 android.hardware.location; - -import android.os.Parcel; -import android.os.Parcelable; - -/** - * A class that represents an Activity Recognition Event. - * - * @hide - */ -public class ActivityRecognitionEvent implements Parcelable { - private final String mActivity; - private final int mEventType; - private final long mTimestampNs; - - public ActivityRecognitionEvent(String activity, int eventType, long timestampNs) { - mActivity = activity; - mEventType = eventType; - mTimestampNs = timestampNs; - } - - public String getActivity() { - return mActivity; - } - - public int getEventType() { - return mEventType; - } - - public long getTimestampNs() { - return mTimestampNs; - } - - public static final Creator CREATOR = - new Creator() { - @Override - public ActivityRecognitionEvent createFromParcel(Parcel source) { - String activity = source.readString(); - int eventType = source.readInt(); - long timestampNs = source.readLong(); - - return new ActivityRecognitionEvent(activity, eventType, timestampNs); - } - - @Override - public ActivityRecognitionEvent[] newArray(int size) { - return new ActivityRecognitionEvent[size]; - } - }; - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel parcel, int flags) { - parcel.writeString(mActivity); - parcel.writeInt(mEventType); - parcel.writeLong(mTimestampNs); - } - - @Override - public String toString() { - return String.format( - "Activity='%s', EventType=%s, TimestampNs=%s", - mActivity, - mEventType, - mTimestampNs); - } -} diff --git a/core/java/android/hardware/location/ActivityRecognitionHardware.java b/core/java/android/hardware/location/ActivityRecognitionHardware.java deleted file mode 100644 index 8acd1ff27917b..0000000000000 --- a/core/java/android/hardware/location/ActivityRecognitionHardware.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright (C) 2014 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 android.hardware.location; - -import android.Manifest; -import android.content.Context; -import android.os.RemoteCallbackList; -import android.os.RemoteException; -import android.text.TextUtils; -import android.util.Log; - -/** - * A class that implements an {@link IActivityRecognitionHardware} backed up by the Activity - * Recognition HAL. - * - * @hide - */ -public class ActivityRecognitionHardware extends IActivityRecognitionHardware.Stub { - private static final String TAG = "ActivityRecognitionHW"; - private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); - - private static final String HARDWARE_PERMISSION = Manifest.permission.LOCATION_HARDWARE; - private static final String ENFORCE_HW_PERMISSION_MESSAGE = "Permission '" - + HARDWARE_PERMISSION + "' not granted to access ActivityRecognitionHardware"; - - private static final int INVALID_ACTIVITY_TYPE = -1; - private static final int NATIVE_SUCCESS_RESULT = 0; - private static final int EVENT_TYPE_DISABLED = 0; - private static final int EVENT_TYPE_ENABLED = 1; - - /** - * Contains the number of supported Event Types. - * - * NOTE: increment this counter every time a new EVENT_TYPE_ is added to - * com.android.location.provider.ActivityRecognitionProvider - */ - private static final int EVENT_TYPE_COUNT = 3; - - private static ActivityRecognitionHardware sSingletonInstance; - private static final Object sSingletonInstanceLock = new Object(); - - private final Context mContext; - private final int mSupportedActivitiesCount; - private final String[] mSupportedActivities; - private final int[][] mSupportedActivitiesEnabledEvents; - private final SinkList mSinks = new SinkList(); - - private static class Event { - public int activity; - public int type; - public long timestamp; - } - - private ActivityRecognitionHardware(Context context) { - nativeInitialize(); - - mContext = context; - mSupportedActivities = fetchSupportedActivities(); - mSupportedActivitiesCount = mSupportedActivities.length; - mSupportedActivitiesEnabledEvents = new int[mSupportedActivitiesCount][EVENT_TYPE_COUNT]; - } - - public static ActivityRecognitionHardware getInstance(Context context) { - synchronized (sSingletonInstanceLock) { - if (sSingletonInstance == null) { - sSingletonInstance = new ActivityRecognitionHardware(context); - } - - return sSingletonInstance; - } - } - - public static boolean isSupported() { - return nativeIsSupported(); - } - - @Override - public String[] getSupportedActivities() { - checkPermissions(); - return mSupportedActivities; - } - - @Override - public boolean isActivitySupported(String activity) { - checkPermissions(); - int activityType = getActivityType(activity); - return activityType != INVALID_ACTIVITY_TYPE; - } - - @Override - public boolean registerSink(IActivityRecognitionHardwareSink sink) { - checkPermissions(); - return mSinks.register(sink); - } - - @Override - public boolean unregisterSink(IActivityRecognitionHardwareSink sink) { - checkPermissions(); - return mSinks.unregister(sink); - } - - @Override - public boolean enableActivityEvent(String activity, int eventType, long reportLatencyNs) { - checkPermissions(); - - int activityType = getActivityType(activity); - if (activityType == INVALID_ACTIVITY_TYPE) { - return false; - } - - int result = nativeEnableActivityEvent(activityType, eventType, reportLatencyNs); - if (result == NATIVE_SUCCESS_RESULT) { - mSupportedActivitiesEnabledEvents[activityType][eventType] = EVENT_TYPE_ENABLED; - return true; - } - return false; - } - - @Override - public boolean disableActivityEvent(String activity, int eventType) { - checkPermissions(); - - int activityType = getActivityType(activity); - if (activityType == INVALID_ACTIVITY_TYPE) { - return false; - } - - int result = nativeDisableActivityEvent(activityType, eventType); - if (result == NATIVE_SUCCESS_RESULT) { - mSupportedActivitiesEnabledEvents[activityType][eventType] = EVENT_TYPE_DISABLED; - return true; - } - return false; - } - - @Override - public boolean flush() { - checkPermissions(); - int result = nativeFlush(); - return result == NATIVE_SUCCESS_RESULT; - } - - /** - * Called by the Activity-Recognition HAL. - */ - private void onActivityChanged(Event[] events) { - if (events == null || events.length == 0) { - if (DEBUG) Log.d(TAG, "No events to broadcast for onActivityChanged."); - return; - } - - int eventsLength = events.length; - ActivityRecognitionEvent activityRecognitionEventArray[] = - new ActivityRecognitionEvent[eventsLength]; - for (int i = 0; i < eventsLength; ++i) { - Event event = events[i]; - String activityName = getActivityName(event.activity); - activityRecognitionEventArray[i] = - new ActivityRecognitionEvent(activityName, event.type, event.timestamp); - } - ActivityChangedEvent activityChangedEvent = - new ActivityChangedEvent(activityRecognitionEventArray); - - int size = mSinks.beginBroadcast(); - for (int i = 0; i < size; ++i) { - IActivityRecognitionHardwareSink sink = mSinks.getBroadcastItem(i); - try { - sink.onActivityChanged(activityChangedEvent); - } catch (RemoteException e) { - Log.e(TAG, "Error delivering activity changed event.", e); - } - } - mSinks.finishBroadcast(); - } - - private String getActivityName(int activityType) { - if (activityType < 0 || activityType >= mSupportedActivities.length) { - String message = String.format( - "Invalid ActivityType: %d, SupportedActivities: %d", - activityType, - mSupportedActivities.length); - Log.e(TAG, message); - return null; - } - - return mSupportedActivities[activityType]; - } - - private int getActivityType(String activity) { - if (TextUtils.isEmpty(activity)) { - return INVALID_ACTIVITY_TYPE; - } - - int supportedActivitiesLength = mSupportedActivities.length; - for (int i = 0; i < supportedActivitiesLength; ++i) { - if (activity.equals(mSupportedActivities[i])) { - return i; - } - } - - return INVALID_ACTIVITY_TYPE; - } - - private void checkPermissions() { - mContext.enforceCallingPermission(HARDWARE_PERMISSION, ENFORCE_HW_PERMISSION_MESSAGE); - } - - private String[] fetchSupportedActivities() { - String[] supportedActivities = nativeGetSupportedActivities(); - if (supportedActivities != null) { - return supportedActivities; - } - - return new String[0]; - } - - private class SinkList extends RemoteCallbackList { - @Override - public void onCallbackDied(IActivityRecognitionHardwareSink callback) { - int callbackCount = mSinks.getRegisteredCallbackCount(); - if (DEBUG) Log.d(TAG, "RegisteredCallbackCount: " + callbackCount); - if (callbackCount != 0) { - return; - } - // currently there is only one client for this, so if all its sinks have died, we clean - // up after them, this ensures that the AR HAL is not out of sink - for (int activity = 0; activity < mSupportedActivitiesCount; ++activity) { - for (int event = 0; event < EVENT_TYPE_COUNT; ++event) { - disableActivityEventIfEnabled(activity, event); - } - } - } - - private void disableActivityEventIfEnabled(int activityType, int eventType) { - if (mSupportedActivitiesEnabledEvents[activityType][eventType] != EVENT_TYPE_ENABLED) { - return; - } - - int result = nativeDisableActivityEvent(activityType, eventType); - mSupportedActivitiesEnabledEvents[activityType][eventType] = EVENT_TYPE_DISABLED; - String message = String.format( - "DisableActivityEvent: activityType=%d, eventType=%d, result=%d", - activityType, - eventType, - result); - Log.e(TAG, message); - } - } - - // native bindings - static { nativeClassInit(); } - - private static native void nativeClassInit(); - private static native boolean nativeIsSupported(); - - private native void nativeInitialize(); - private native void nativeRelease(); - private native String[] nativeGetSupportedActivities(); - private native int nativeEnableActivityEvent( - int activityType, - int eventType, - long reportLatenceNs); - private native int nativeDisableActivityEvent(int activityType, int eventType); - private native int nativeFlush(); -} diff --git a/core/java/android/hardware/location/IActivityRecognitionHardware.aidl b/core/java/android/hardware/location/IActivityRecognitionHardware.aidl deleted file mode 100644 index bc6b1830cd4f1..0000000000000 --- a/core/java/android/hardware/location/IActivityRecognitionHardware.aidl +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2014, 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/license/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 android.hardware.location; - -import android.hardware.location.IActivityRecognitionHardwareSink; - -/** - * Activity Recognition Hardware provider interface. - * This interface can be used to implement hardware based activity recognition. - * - * @hide - */ -interface IActivityRecognitionHardware { - /** - * Gets an array of supported activities by hardware. - */ - String[] getSupportedActivities(); - - /** - * Returns true if the given activity is supported, false otherwise. - */ - boolean isActivitySupported(in String activityType); - - /** - * Registers a sink with Hardware Activity-Recognition. - */ - boolean registerSink(in IActivityRecognitionHardwareSink sink); - - /** - * Unregisters a sink with Hardware Activity-Recognition. - */ - boolean unregisterSink(in IActivityRecognitionHardwareSink sink); - - /** - * Enables tracking of a given activity/event type, if the activity is supported. - */ - boolean enableActivityEvent(in String activityType, int eventType, long reportLatencyNs); - - /** - * Disables tracking of a given activity/eventy type. - */ - boolean disableActivityEvent(in String activityType, int eventType); - - /** - * Requests hardware for all the activity events detected up to the given point in time. - */ - boolean flush(); -} \ No newline at end of file diff --git a/core/java/android/hardware/location/IActivityRecognitionHardwareClient.aidl b/core/java/android/hardware/location/IActivityRecognitionHardwareClient.aidl deleted file mode 100644 index 3fe645c59a301..0000000000000 --- a/core/java/android/hardware/location/IActivityRecognitionHardwareClient.aidl +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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/license/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 android.hardware.location; - -import android.hardware.location.IActivityRecognitionHardware; - -/** - * Activity Recognition Hardware client interface. - * This interface can be used to receive interfaces to implementations of - * {@link IActivityRecognitionHardware}. - * - * @hide - */ -oneway interface IActivityRecognitionHardwareClient { - /** - * Hardware Activity-Recognition availability event. - * - * @param isSupported whether the platform has hardware support for the feature - * @param instance the available instance to provide access to the feature - */ - void onAvailabilityChanged(in boolean isSupported, in IActivityRecognitionHardware instance); -} diff --git a/core/java/android/hardware/location/IActivityRecognitionHardwareSink.aidl b/core/java/android/hardware/location/IActivityRecognitionHardwareSink.aidl deleted file mode 100644 index 21c8e87e6c6d3..0000000000000 --- a/core/java/android/hardware/location/IActivityRecognitionHardwareSink.aidl +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2014, 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/license/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 android.hardware.location; - -import android.hardware.location.ActivityChangedEvent; - -/** - * Activity Recognition Hardware provider Sink interface. - * This interface can be used to implement sinks to receive activity notifications. - * - * @hide - */ -interface IActivityRecognitionHardwareSink { - /** - * Activity changed event. - */ - void onActivityChanged(in ActivityChangedEvent event); -} \ No newline at end of file diff --git a/core/java/android/hardware/location/IActivityRecognitionHardwareWatcher.aidl b/core/java/android/hardware/location/IActivityRecognitionHardwareWatcher.aidl deleted file mode 100644 index 12e3117259e16..0000000000000 --- a/core/java/android/hardware/location/IActivityRecognitionHardwareWatcher.aidl +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2014, 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/license/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 android.hardware.location; - -import android.hardware.location.IActivityRecognitionHardware; - -/** - * Activity Recognition Hardware watcher. This interface can be used to receive interfaces to - * implementations of {@link IActivityRecognitionHardware}. - * - * @deprecated use {@link IActivityRecognitionHardwareClient} instead. - - * @hide - */ -interface IActivityRecognitionHardwareWatcher { - /** - * Hardware Activity-Recognition availability event. - */ - void onInstanceChanged(in IActivityRecognitionHardware instance); -} diff --git a/core/jni/Android.bp b/core/jni/Android.bp index 088e13ff92bc1..5be70ef46d313 100644 --- a/core/jni/Android.bp +++ b/core/jni/Android.bp @@ -185,7 +185,6 @@ cc_library_shared { "android_hardware_UsbDevice.cpp", "android_hardware_UsbDeviceConnection.cpp", "android_hardware_UsbRequest.cpp", - "android_hardware_location_ActivityRecognitionHardware.cpp", "android_util_FileObserver.cpp", "android/opengl/poly_clip.cpp", // TODO: .arm "android/opengl/util.cpp", diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 109222298fe5c..a586dc1e6d7eb 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -101,7 +101,6 @@ extern int register_android_hardware_SoundTrigger(JNIEnv *env); extern int register_android_hardware_UsbDevice(JNIEnv *env); extern int register_android_hardware_UsbDeviceConnection(JNIEnv *env); extern int register_android_hardware_UsbRequest(JNIEnv *env); -extern int register_android_hardware_location_ActivityRecognitionHardware(JNIEnv* env); extern int register_android_media_AudioEffectDescriptor(JNIEnv *env); extern int register_android_media_AudioRecord(JNIEnv *env); @@ -1457,7 +1456,6 @@ static const RegJNIRec gRegJNI[] = { REG_JNI(register_android_hardware_UsbDevice), REG_JNI(register_android_hardware_UsbDeviceConnection), REG_JNI(register_android_hardware_UsbRequest), - REG_JNI(register_android_hardware_location_ActivityRecognitionHardware), REG_JNI(register_android_media_AudioEffectDescriptor), REG_JNI(register_android_media_AudioSystem), REG_JNI(register_android_media_AudioRecord), diff --git a/core/jni/android_hardware_location_ActivityRecognitionHardware.cpp b/core/jni/android_hardware_location_ActivityRecognitionHardware.cpp deleted file mode 100644 index 1c9ab9403298e..0000000000000 --- a/core/jni/android_hardware_location_ActivityRecognitionHardware.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright 2014, 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. - */ - -#define LOG_TAG "ActivityRecognitionHardware" - -#include -#include - -#include -#include - -// #include -// The activity recognition HAL is being deprecated. This means - -// i) Android framework code shall not depend on activity recognition -// being provided through the activity_recognition.h interface. -// ii) activity recognition HAL will not be binderized as the other HALs. -// - -/** - * Initializes the ActivityRecognitionHardware class from the native side. - */ -static void class_init(JNIEnv* /*env*/, jclass /*clazz*/) { - ALOGE("activity_recognition HAL is deprecated. %s is effectively a no-op", - __FUNCTION__); -} - -/** - * Initializes and connect the callbacks handlers in the HAL. - */ -static void initialize(JNIEnv* /*env*/, jobject /*obj*/) { - ALOGE("activity_recognition HAL is deprecated. %s is effectively a no-op", - __FUNCTION__); -} - -/** - * De-initializes the ActivityRecognitionHardware from the native side. - */ -static void release(JNIEnv* /*env*/, jobject /*obj*/) { - ALOGE("activity_recognition HAL is deprecated. %s is effectively a no-op", - __FUNCTION__); -} - -/** - * Returns true if ActivityRecognition HAL is supported, false otherwise. - */ -static jboolean is_supported(JNIEnv* /*env*/, jclass /*clazz*/) { - ALOGE("activity_recognition HAL is deprecated. %s is effectively a no-op", - __FUNCTION__); - return JNI_FALSE; -} - -/** - * Gets an array representing the supported activities. - */ -static jobjectArray get_supported_activities(JNIEnv* /*env*/, jobject /*obj*/) { - ALOGE("activity_recognition HAL is deprecated. %s is effectively a no-op", - __FUNCTION__); - return NULL; -} - -/** - * Enables a given activity event to be actively monitored. - */ -static int enable_activity_event( - JNIEnv* /*env*/, - jobject /*obj*/, - jint /*activity_handle*/, - jint /*event_type*/, - jlong /*report_latency_ns*/) { - ALOGE("activity_recognition HAL is deprecated. %s is effectively a no-op", - __FUNCTION__); - return android::NO_INIT; -} - -/** - * Disables a given activity event from being actively monitored. - */ -static int disable_activity_event( - JNIEnv* /*env*/, - jobject /*obj*/, - jint /*activity_handle*/, - jint /*event_type*/) { - ALOGE("activity_recognition HAL is deprecated. %s is effectively a no-op", - __FUNCTION__); - return android::NO_INIT; -} - -/** - * Request flush for al batch buffers. - */ -static int flush(JNIEnv* /*env*/, jobject /*obj*/) { - ALOGE("activity_recognition HAL is deprecated. %s is effectively a no-op", - __FUNCTION__); - return android::NO_INIT; -} - - -static const JNINativeMethod sMethods[] = { - // {"name", "signature", (void*) functionPointer }, - { "nativeClassInit", "()V", (void*) class_init }, - { "nativeInitialize", "()V", (void*) initialize }, - { "nativeRelease", "()V", (void*) release }, - { "nativeIsSupported", "()Z", (void*) is_supported }, - { "nativeGetSupportedActivities", "()[Ljava/lang/String;", (void*) get_supported_activities }, - { "nativeEnableActivityEvent", "(IIJ)I", (void*) enable_activity_event }, - { "nativeDisableActivityEvent", "(II)I", (void*) disable_activity_event }, - { "nativeFlush", "()I", (void*) flush }, -}; - -/** - * Registration method invoked in JNI load. - */ -int register_android_hardware_location_ActivityRecognitionHardware(JNIEnv* env) { - return jniRegisterNativeMethods( - env, - "android/hardware/location/ActivityRecognitionHardware", - sMethods, - NELEM(sMethods)); -} diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 656445877322a..c1ae02665a8ea 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -1740,19 +1740,6 @@ config_enableGeofenceOverlay is false. --> @null - - true - - @null -