Loading services/core/java/com/android/server/location/contexthub/ContextHubService.java +1 −2 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ import android.database.ContentObserver; import android.hardware.SensorPrivacyManager; import android.hardware.SensorPrivacyManagerInternal; import android.hardware.contexthub.V1_0.AsyncEventType; import android.hardware.contexthub.V1_0.ContextHub; import android.hardware.contexthub.V1_0.ContextHubMsg; import android.hardware.contexthub.V1_0.Result; import android.hardware.contexthub.V1_0.TransactionResult; Loading Loading @@ -200,7 +199,7 @@ public class ContextHubService extends IContextHubService.Stub { return; } Pair<List<ContextHub>, List<String>> hubInfo; Pair<List<ContextHubInfo>, List<String>> hubInfo; try { hubInfo = mContextHubWrapper.getHubs(); } catch (RemoteException e) { Loading services/core/java/com/android/server/location/contexthub/ContextHubServiceUtil.java +3 −4 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.content.pm.PackageManager.PERMISSION_GRANTED; import android.Manifest; import android.content.Context; import android.hardware.contexthub.V1_0.ContextHub; import android.hardware.contexthub.V1_0.ContextHubMsg; import android.hardware.contexthub.V1_0.HostEndPoint; import android.hardware.contexthub.V1_0.Result; Loading Loading @@ -52,10 +51,10 @@ import java.util.List; * @return the HashMap object */ /* package */ static HashMap<Integer, ContextHubInfo> createContextHubInfoMap(List<ContextHub> hubList) { static HashMap<Integer, ContextHubInfo> createContextHubInfoMap(List<ContextHubInfo> hubList) { HashMap<Integer, ContextHubInfo> contextHubIdToInfoMap = new HashMap<>(); for (ContextHub contextHub : hubList) { contextHubIdToInfoMap.put(contextHub.hubId, new ContextHubInfo(contextHub)); for (ContextHubInfo contextHubInfo : hubList) { contextHubIdToInfoMap.put(contextHubInfo.getId(), contextHubInfo); } return contextHubIdToInfoMap; Loading services/core/java/com/android/server/location/contexthub/IContextHubWrapper.java +21 −8 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.hardware.contexthub.V1_0.ContextHub; import android.hardware.contexthub.V1_1.Setting; import android.hardware.contexthub.V1_1.SettingValue; import android.hardware.contexthub.V1_2.IContexthubCallback; import android.hardware.location.ContextHubInfo; import android.os.RemoteException; import android.util.Log; import android.util.Pair; Loading Loading @@ -95,7 +96,7 @@ public abstract class IContextHubWrapper { /** * Calls the appropriate getHubs function depending on the HAL version. */ public abstract Pair<List<ContextHub>, List<String>> getHubs() throws RemoteException; public abstract Pair<List<ContextHubInfo>, List<String>> getHubs() throws RemoteException; /** * Calls the appropriate registerCallback function depending on the HAL version. Loading Loading @@ -165,8 +166,12 @@ public abstract class IContextHubWrapper { mHub = hub; } public Pair<List<ContextHub>, List<String>> getHubs() throws RemoteException { return new Pair(mHub.getHubs(), new ArrayList<String>()); public Pair<List<ContextHubInfo>, List<String>> getHubs() throws RemoteException { ArrayList<ContextHubInfo> hubInfoList = new ArrayList<>(); for (ContextHub hub : mHub.getHubs()) { hubInfoList.add(new ContextHubInfo(hub)); } return new Pair(hubInfoList, new ArrayList<String>()); } public void registerCallback( Loading Loading @@ -214,8 +219,12 @@ public abstract class IContextHubWrapper { mHub = hub; } public Pair<List<ContextHub>, List<String>> getHubs() throws RemoteException { return new Pair(mHub.getHubs(), new ArrayList<String>()); public Pair<List<ContextHubInfo>, List<String>> getHubs() throws RemoteException { ArrayList<ContextHubInfo> hubInfoList = new ArrayList<>(); for (ContextHub hub : mHub.getHubs()) { hubInfoList.add(new ContextHubInfo(hub)); } return new Pair(hubInfoList, new ArrayList<String>()); } public void registerCallback( Loading Loading @@ -266,7 +275,7 @@ public abstract class IContextHubWrapper { implements android.hardware.contexthub.V1_2.IContexthub.getHubs_1_2Callback { private final android.hardware.contexthub.V1_2.IContexthub mHub; private Pair<List<ContextHub>, List<String>> mHubInfo = private Pair<List<ContextHubInfo>, List<String>> mHubInfo = new Pair<>(Collections.emptyList(), Collections.emptyList()); ContextHubWrapperV1_2(android.hardware.contexthub.V1_2.IContexthub hub) { Loading @@ -275,10 +284,14 @@ public abstract class IContextHubWrapper { @Override public void onValues(ArrayList<ContextHub> hubs, ArrayList<String> supportedPermissions) { mHubInfo = new Pair(hubs, supportedPermissions); ArrayList<ContextHubInfo> hubInfoList = new ArrayList<>(); for (ContextHub hub : hubs) { hubInfoList.add(new ContextHubInfo(hub)); } mHubInfo = new Pair(hubInfoList, supportedPermissions); } public Pair<List<ContextHub>, List<String>> getHubs() throws RemoteException { public Pair<List<ContextHubInfo>, List<String>> getHubs() throws RemoteException { mHub.getHubs_1_2(this); return mHubInfo; } Loading Loading
services/core/java/com/android/server/location/contexthub/ContextHubService.java +1 −2 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ import android.database.ContentObserver; import android.hardware.SensorPrivacyManager; import android.hardware.SensorPrivacyManagerInternal; import android.hardware.contexthub.V1_0.AsyncEventType; import android.hardware.contexthub.V1_0.ContextHub; import android.hardware.contexthub.V1_0.ContextHubMsg; import android.hardware.contexthub.V1_0.Result; import android.hardware.contexthub.V1_0.TransactionResult; Loading Loading @@ -200,7 +199,7 @@ public class ContextHubService extends IContextHubService.Stub { return; } Pair<List<ContextHub>, List<String>> hubInfo; Pair<List<ContextHubInfo>, List<String>> hubInfo; try { hubInfo = mContextHubWrapper.getHubs(); } catch (RemoteException e) { Loading
services/core/java/com/android/server/location/contexthub/ContextHubServiceUtil.java +3 −4 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.content.pm.PackageManager.PERMISSION_GRANTED; import android.Manifest; import android.content.Context; import android.hardware.contexthub.V1_0.ContextHub; import android.hardware.contexthub.V1_0.ContextHubMsg; import android.hardware.contexthub.V1_0.HostEndPoint; import android.hardware.contexthub.V1_0.Result; Loading Loading @@ -52,10 +51,10 @@ import java.util.List; * @return the HashMap object */ /* package */ static HashMap<Integer, ContextHubInfo> createContextHubInfoMap(List<ContextHub> hubList) { static HashMap<Integer, ContextHubInfo> createContextHubInfoMap(List<ContextHubInfo> hubList) { HashMap<Integer, ContextHubInfo> contextHubIdToInfoMap = new HashMap<>(); for (ContextHub contextHub : hubList) { contextHubIdToInfoMap.put(contextHub.hubId, new ContextHubInfo(contextHub)); for (ContextHubInfo contextHubInfo : hubList) { contextHubIdToInfoMap.put(contextHubInfo.getId(), contextHubInfo); } return contextHubIdToInfoMap; Loading
services/core/java/com/android/server/location/contexthub/IContextHubWrapper.java +21 −8 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.hardware.contexthub.V1_0.ContextHub; import android.hardware.contexthub.V1_1.Setting; import android.hardware.contexthub.V1_1.SettingValue; import android.hardware.contexthub.V1_2.IContexthubCallback; import android.hardware.location.ContextHubInfo; import android.os.RemoteException; import android.util.Log; import android.util.Pair; Loading Loading @@ -95,7 +96,7 @@ public abstract class IContextHubWrapper { /** * Calls the appropriate getHubs function depending on the HAL version. */ public abstract Pair<List<ContextHub>, List<String>> getHubs() throws RemoteException; public abstract Pair<List<ContextHubInfo>, List<String>> getHubs() throws RemoteException; /** * Calls the appropriate registerCallback function depending on the HAL version. Loading Loading @@ -165,8 +166,12 @@ public abstract class IContextHubWrapper { mHub = hub; } public Pair<List<ContextHub>, List<String>> getHubs() throws RemoteException { return new Pair(mHub.getHubs(), new ArrayList<String>()); public Pair<List<ContextHubInfo>, List<String>> getHubs() throws RemoteException { ArrayList<ContextHubInfo> hubInfoList = new ArrayList<>(); for (ContextHub hub : mHub.getHubs()) { hubInfoList.add(new ContextHubInfo(hub)); } return new Pair(hubInfoList, new ArrayList<String>()); } public void registerCallback( Loading Loading @@ -214,8 +219,12 @@ public abstract class IContextHubWrapper { mHub = hub; } public Pair<List<ContextHub>, List<String>> getHubs() throws RemoteException { return new Pair(mHub.getHubs(), new ArrayList<String>()); public Pair<List<ContextHubInfo>, List<String>> getHubs() throws RemoteException { ArrayList<ContextHubInfo> hubInfoList = new ArrayList<>(); for (ContextHub hub : mHub.getHubs()) { hubInfoList.add(new ContextHubInfo(hub)); } return new Pair(hubInfoList, new ArrayList<String>()); } public void registerCallback( Loading Loading @@ -266,7 +275,7 @@ public abstract class IContextHubWrapper { implements android.hardware.contexthub.V1_2.IContexthub.getHubs_1_2Callback { private final android.hardware.contexthub.V1_2.IContexthub mHub; private Pair<List<ContextHub>, List<String>> mHubInfo = private Pair<List<ContextHubInfo>, List<String>> mHubInfo = new Pair<>(Collections.emptyList(), Collections.emptyList()); ContextHubWrapperV1_2(android.hardware.contexthub.V1_2.IContexthub hub) { Loading @@ -275,10 +284,14 @@ public abstract class IContextHubWrapper { @Override public void onValues(ArrayList<ContextHub> hubs, ArrayList<String> supportedPermissions) { mHubInfo = new Pair(hubs, supportedPermissions); ArrayList<ContextHubInfo> hubInfoList = new ArrayList<>(); for (ContextHub hub : hubs) { hubInfoList.add(new ContextHubInfo(hub)); } mHubInfo = new Pair(hubInfoList, supportedPermissions); } public Pair<List<ContextHub>, List<String>> getHubs() throws RemoteException { public Pair<List<ContextHubInfo>, List<String>> getHubs() throws RemoteException { mHub.getHubs_1_2(this); return mHubInfo; } Loading