Merge "Backports implementation for AltitudeService to T." am: 026325fe68
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2416929 Change-Id: Ide3cd85a103c67b9f9c541a95c73005c14bfadf7 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -178,6 +178,10 @@ java_library {
|
|||||||
"service-sdksandbox.stubs.system_server",
|
"service-sdksandbox.stubs.system_server",
|
||||||
],
|
],
|
||||||
|
|
||||||
|
vintf_fragments: [
|
||||||
|
"manifest_services.xml",
|
||||||
|
],
|
||||||
|
|
||||||
// Uncomment to enable output of certain warnings (deprecated, unchecked)
|
// Uncomment to enable output of certain warnings (deprecated, unchecked)
|
||||||
//javacflags: ["-Xlint"],
|
//javacflags: ["-Xlint"],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ java_library_static {
|
|||||||
],
|
],
|
||||||
|
|
||||||
static_libs: [
|
static_libs: [
|
||||||
|
"android.frameworks.location.altitude-V1-java", // AIDL
|
||||||
"android.hardware.authsecret-V1.0-java",
|
"android.hardware.authsecret-V1.0-java",
|
||||||
"android.hardware.boot-V1.0-java", // HIDL
|
"android.hardware.boot-V1.0-java", // HIDL
|
||||||
"android.hardware.boot-V1.1-java", // HIDL
|
"android.hardware.boot-V1.1-java", // HIDL
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 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.server.location.altitude;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.frameworks.location.altitude.AddMslAltitudeToLocationRequest;
|
||||||
|
import android.frameworks.location.altitude.AddMslAltitudeToLocationResponse;
|
||||||
|
import android.frameworks.location.altitude.IAltitudeService;
|
||||||
|
import android.location.Location;
|
||||||
|
import android.location.altitude.AltitudeConverter;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
|
||||||
|
import com.android.server.SystemService;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manages altitude information exchange through the HAL, e.g., geoid height requests such that
|
||||||
|
* vendors can perform altitude conversions.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public class AltitudeService extends IAltitudeService.Stub {
|
||||||
|
|
||||||
|
private final AltitudeConverter mAltitudeConverter = new AltitudeConverter();
|
||||||
|
private final Context mContext;
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public AltitudeService(Context context) {
|
||||||
|
mContext = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AddMslAltitudeToLocationResponse addMslAltitudeToLocation(
|
||||||
|
AddMslAltitudeToLocationRequest request) throws RemoteException {
|
||||||
|
Location location = new Location("");
|
||||||
|
location.setLatitude(request.latitudeDegrees);
|
||||||
|
location.setLongitude(request.longitudeDegrees);
|
||||||
|
location.setAltitude(request.altitudeMeters);
|
||||||
|
location.setVerticalAccuracyMeters(request.verticalAccuracyMeters);
|
||||||
|
try {
|
||||||
|
mAltitudeConverter.addMslAltitudeToLocation(mContext, location);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RemoteException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
AddMslAltitudeToLocationResponse response = new AddMslAltitudeToLocationResponse();
|
||||||
|
response.mslAltitudeMeters = location.getMslAltitudeMeters();
|
||||||
|
response.mslAltitudeAccuracyMeters = location.getMslAltitudeAccuracyMeters();
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getInterfaceHash() {
|
||||||
|
return IAltitudeService.HASH;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInterfaceVersion() {
|
||||||
|
return IAltitudeService.VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public static class Lifecycle extends SystemService {
|
||||||
|
|
||||||
|
private static final String SERVICE_NAME = IAltitudeService.DESCRIPTOR + "/default";
|
||||||
|
|
||||||
|
private AltitudeService mService;
|
||||||
|
|
||||||
|
public Lifecycle(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
mService = new AltitudeService(getContext());
|
||||||
|
publishBinderService(SERVICE_NAME, mService);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -139,6 +139,7 @@ import com.android.server.integrity.AppIntegrityManagerService;
|
|||||||
import com.android.server.lights.LightsService;
|
import com.android.server.lights.LightsService;
|
||||||
import com.android.server.locales.LocaleManagerService;
|
import com.android.server.locales.LocaleManagerService;
|
||||||
import com.android.server.location.LocationManagerService;
|
import com.android.server.location.LocationManagerService;
|
||||||
|
import com.android.server.location.altitude.AltitudeService;
|
||||||
import com.android.server.logcat.LogcatManagerService;
|
import com.android.server.logcat.LogcatManagerService;
|
||||||
import com.android.server.media.MediaRouterService;
|
import com.android.server.media.MediaRouterService;
|
||||||
import com.android.server.media.metrics.MediaMetricsManagerService;
|
import com.android.server.media.metrics.MediaMetricsManagerService;
|
||||||
@@ -2098,6 +2099,14 @@ public final class SystemServer implements Dumpable {
|
|||||||
}
|
}
|
||||||
t.traceEnd();
|
t.traceEnd();
|
||||||
|
|
||||||
|
t.traceBegin("StartAltitudeService");
|
||||||
|
try {
|
||||||
|
mSystemServiceManager.startService(AltitudeService.Lifecycle.class);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
reportWtf("starting AltitudeService service", e);
|
||||||
|
}
|
||||||
|
t.traceEnd();
|
||||||
|
|
||||||
t.traceBegin("StartLocationTimeZoneManagerService");
|
t.traceBegin("StartLocationTimeZoneManagerService");
|
||||||
try {
|
try {
|
||||||
mSystemServiceManager.startService(LOCATION_TIME_ZONE_MANAGER_SERVICE_CLASS);
|
mSystemServiceManager.startService(LOCATION_TIME_ZONE_MANAGER_SERVICE_CLASS);
|
||||||
|
|||||||
7
services/manifest_services.xml
Normal file
7
services/manifest_services.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<manifest version="1.0" type="framework">
|
||||||
|
<hal format="aidl">
|
||||||
|
<name>android.frameworks.location.altitude</name>
|
||||||
|
<version>1</version>
|
||||||
|
<fqname>IAltitudeService/default</fqname>
|
||||||
|
</hal>
|
||||||
|
</manifest>
|
||||||
Reference in New Issue
Block a user