Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f3882c86 authored by Peng Xu's avatar Peng Xu Committed by android-build-merger
Browse files

Merge "Exposing Context Hub service." into nyc-dev

am: ac329d3e

* commit 'ac329d3e':
  Exposing Context Hub service.
parents 0a2d7372 ac329d3e
Loading
Loading
Loading
Loading
+10 −15
Original line number Diff line number Diff line
@@ -8409,6 +8409,7 @@ package android.content {
    field public static final java.lang.String CLIPBOARD_SERVICE = "clipboard";
    field public static final java.lang.String CONNECTIVITY_SERVICE = "connectivity";
    field public static final java.lang.String CONSUMER_IR_SERVICE = "consumer_ir";
    field public static final java.lang.String CONTEXTHUB_SERVICE = "contexthub";
    field public static final int CONTEXT_IGNORE_SECURITY = 2; // 0x2
    field public static final int CONTEXT_INCLUDE_CODE = 1; // 0x1
    field public static final int CONTEXT_RESTRICTED = 4; // 0x4
@@ -15277,37 +15278,31 @@ package android.hardware.location {
    method public java.lang.String getToolchain();
    method public int getToolchainVersion();
    method public java.lang.String getVendor();
    method public void setId(int);
    method public void setMemoryRegions(android.hardware.location.MemoryRegion[]);
    method public void setName(java.lang.String);
    method public void setPeakMips(float);
    method public void setPeakPowerDrawMw(float);
    method public void setPlatformVersion(int);
    method public void setSleepPowerDrawMw(float);
    method public void setStaticSwVersion(int);
    method public void setStoppedPowerDrawMw(float);
    method public void setSupportedSensors(int[]);
    method public void setToolchain(java.lang.String);
    method public void setToolchainVersion(int);
    method public void setVendor(java.lang.String);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.location.ContextHubInfo> CREATOR;
  }
  public final class ContextHubManager {
    method public java.lang.Integer[] findNanoAppOnHub(int, android.hardware.location.NanoAppFilter);
    method public int[] getContexthubHandles();
    method public android.hardware.location.ContextHubInfo getContexthubInfo(int);
    method public int[] getContextHubHandles();
    method public android.hardware.location.ContextHubInfo getContextHubInfo(int);
    method public android.hardware.location.NanoAppInstanceInfo getNanoAppInstanceInfo(int);
    method public int loadNanoApp(int, android.hardware.location.NanoApp);
    method public int registerContextHubCallback(android.hardware.location.ContextHubManager.ContextHubCallback);
    method public int registerContextHubCallback(android.hardware.location.ContextHubManager.ContextHubCallback, android.os.Handler);
    method public int sendMessage(int, int, android.hardware.location.ContextHubMessage);
    method public int unloadNanoApp(int);
    method public int unregisterContextHubCallback(android.hardware.location.ContextHubManager.ContextHubCallback);
    field public static final int ANY_HUB = -1; // 0xffffffff
    field public static final int MSG_DATA_SEND = 3; // 0x3
    field public static final int MSG_LOAD_NANO_APP = 1; // 0x1
    field public static final int MSG_UNLOAD_NANO_APP = 2; // 0x2
  }
  public abstract class ContextHubManager.ContextHubCallback {
    ctor public ContextHubManager.ContextHubCallback();
  }
  public class ContextHubMessage {
    ctor public ContextHubMessage(int, int, byte[]);
    method public int describeContents();
+9 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import android.hardware.display.DisplayManager;
import android.hardware.hdmi.HdmiControlManager;
import android.hardware.hdmi.IHdmiControlService;
import android.hardware.input.InputManager;
import android.hardware.location.ContextHubManager;
import android.hardware.usb.IUsbManager;
import android.hardware.usb.UsbManager;
import android.hardware.radio.RadioManager;
@@ -765,6 +766,14 @@ final class SystemServiceRegistry {
            public SystemHealthManager createService(ContextImpl ctx) {
                return new SystemHealthManager();
            }});

        registerService(Context.CONTEXTHUB_SERVICE, ContextHubManager.class,
                new CachedServiceFetcher<ContextHubManager>() {
            @Override
            public ContextHubManager createService(ContextImpl ctx) {
                return new ContextHubManager(ctx.getOuterContext(),
                  ctx.mMainThread.getHandler().getLooper());
            }});
    }

    /**
+13 −0
Original line number Diff line number Diff line
@@ -2681,6 +2681,7 @@ public abstract class Context {
            HARDWARE_PROPERTIES_SERVICE,
            //@hide: SOUND_TRIGGER_SERVICE,
            SHORTCUT_SERVICE,
            //@hide: CONTEXTHUB_SERVICE,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface ServiceName {}
@@ -3584,6 +3585,18 @@ public abstract class Context {
     */
    public static final String SHORTCUT_SERVICE = "shortcut";

    /**
     * Use with {@link #getSystemService} to retrieve a {@link
     * android.hardware.location.ContextHubManager} for accessing context hubs.
     *
     * @see #getSystemService
     * @see android.hardware.location.ContextHubManager
     *
     * @hide
     */
    @SystemApi
    public static final String CONTEXTHUB_SERVICE = "contexthub";

    /**
     * Use with {@link #getSystemService} to retrieve a
     * {@link android.os.health.SystemHealthManager} for accessing system health (battery, power,
+3 −3
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
 */

package android.hardware.location;
/*
@hide
/**
 * @hide
 */
parcelable ContextHubInfo;
+30 −4
Original line number Diff line number Diff line
@@ -58,6 +58,8 @@ public class ContextHubInfo {
     * set the context hub unique identifer
     *
     * @param id - unique system wide identifier for the hub
     *
     * @hide
     */
    public void setId(int id) {
        mId = id;
@@ -75,7 +77,9 @@ public class ContextHubInfo {
    /**
     * set a string as the hub name
     *
     * @param String - the name for the hub
     * @param name - the name for the hub
     *
     * @hide
     */
    public void setName(String name) {
        mName = name;
@@ -93,7 +97,9 @@ public class ContextHubInfo {
    /**
     * set a string as the vendor name
     *
     * @param String - a name for the vendor
     * @param vendor - a name for the vendor
     *
     * @hide
     */
    public void setVendor(String vendor) {
        mVendor = vendor;
@@ -111,7 +117,9 @@ public class ContextHubInfo {
    /**
     * set tool chain string
     *
     * @param String - description of the tool chain
     * @param toolchain - description of the tool chain
     *
     * @hide
     */
    public void setToolchain(String toolchain) {
        mToolchain = toolchain;
@@ -130,6 +138,8 @@ public class ContextHubInfo {
     * set platform version
     *
     * @param platformVersion - platform version number
     *
     * @hide
     */
    public void setPlatformVersion(int platformVersion) {
        mPlatformVersion = platformVersion;
@@ -148,6 +158,8 @@ public class ContextHubInfo {
     * set platform software version
     *
     * @param staticSwVersion - platform static s/w version number
     *
     * @hide
     */
    public void setStaticSwVersion(int staticSwVersion) {
        mStaticSwVersion = staticSwVersion;
@@ -166,6 +178,8 @@ public class ContextHubInfo {
     * set the tool chain version number
     *
     * @param toolchainVersion - tool chain version number
     *
     * @hide
     */
    public void setToolchainVersion(int toolchainVersion) {
        mToolchainVersion = toolchainVersion;
@@ -184,6 +198,8 @@ public class ContextHubInfo {
     * set the peak mips that this hub can support
     *
     * @param peakMips - peak mips this hub can deliver
     *
     * @hide
     */
    public void setPeakMips(float peakMips) {
        mPeakMips = peakMips;
@@ -206,6 +222,8 @@ public class ContextHubInfo {
     * Set the power consumed by the hub in stopped state
     *
     * @param stoppedPowerDrawMw - stopped power in milli watts
     *
     * @hide
     */
    public void setStoppedPowerDrawMw(float stoppedPowerDrawMw) {
        mStoppedPowerDrawMw = stoppedPowerDrawMw;
@@ -230,6 +248,8 @@ public class ContextHubInfo {
     * Set the sleep power draw in milliwatts
     *
     * @param sleepPowerDrawMw - sleep power draw in milliwatts.
     *
     * @hide
     */
    public void setSleepPowerDrawMw(float sleepPowerDrawMw) {
        mSleepPowerDrawMw = sleepPowerDrawMw;
@@ -250,6 +270,8 @@ public class ContextHubInfo {
     *
     * @param peakPowerDrawMw - peak power draw of the hub in
     *                        milliwatts.
     *
     * @hide
     */
    public void setPeakPowerDrawMw(float peakPowerDrawMw) {
        mPeakPowerDrawMw = peakPowerDrawMw;
@@ -281,6 +303,8 @@ public class ContextHubInfo {
     * set the supported sensors on this hub
     *
     * @param supportedSensors - supported sensors on this hub
     *
     * @hide
     */
    public void setSupportedSensors(int[] supportedSensors) {
        mSupportedSensors = Arrays.copyOf(supportedSensors, supportedSensors.length);
@@ -292,6 +316,8 @@ public class ContextHubInfo {
     * @param memoryRegions - memory regions information
     *
     * @see MemoryRegion
     *
     * @hide
     */
    public void setMemoryRegions(MemoryRegion[] memoryRegions) {
        mMemoryRegions = Arrays.copyOf(memoryRegions, memoryRegions.length);
Loading