Location: fix LocationSettingsRequest parcelable

This commit is contained in:
Marvin W 2021-06-06 16:00:43 -06:00
parent a830b5dd5d
commit 6555997664
No known key found for this signature in database
GPG Key ID: 072E9235DB996F2A
2 changed files with 32 additions and 18 deletions

View File

@ -0,0 +1,19 @@
/*
* SPDX-FileCopyrightText: 2021, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.android.gms.location;
import org.microg.safeparcel.AutoSafeParcelable;
public class LocationSettingsConfiguration extends AutoSafeParcelable {
@Field(1)
public String justificationText;
@Field(2)
public String experimentId;
@Field(5)
public String titleText;
public static final Creator<LocationSettingsConfiguration> CREATOR = new AutoCreator<>(LocationSettingsConfiguration.class);
}

View File

@ -1,17 +1,6 @@
/* /*
* Copyright (C) 2013-2017 microG Project Team * SPDX-FileCopyrightText: 2015, microG Project Team
* * SPDX-License-Identifier: Apache-2.0
* 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.google.android.gms.location; package com.google.android.gms.location;
@ -26,27 +15,33 @@ import java.util.List;
@PublicApi @PublicApi
public class LocationSettingsRequest extends AutoSafeParcelable { public class LocationSettingsRequest extends AutoSafeParcelable {
@SafeParceled(1000) @Field(1000)
private int versionCode = 2; private int versionCode = 2;
@SafeParceled(value = 1, subClass = LocationRequest.class) @Field(value = 1, subClass = LocationRequest.class)
@PublicApi(exclude = true) @PublicApi(exclude = true)
public List<LocationRequest> requests; public List<LocationRequest> requests;
@SafeParceled(2) @Field(2)
@PublicApi(exclude = true) @PublicApi(exclude = true)
public boolean alwaysShow; public boolean alwaysShow;
@Field(3)
@PublicApi(exclude = true) @PublicApi(exclude = true)
public boolean needBle; public boolean needBle;
@Field(5)
@PublicApi(exclude = true)
public LocationSettingsConfiguration configuration;
private LocationSettingsRequest() { private LocationSettingsRequest() {
} }
private LocationSettingsRequest(List<LocationRequest> requests, boolean alwaysShow, boolean needBle) { private LocationSettingsRequest(List<LocationRequest> requests, boolean alwaysShow, boolean needBle, LocationSettingsConfiguration configuration) {
this.requests = requests; this.requests = requests;
this.alwaysShow = alwaysShow; this.alwaysShow = alwaysShow;
this.needBle = needBle; this.needBle = needBle;
this.configuration = configuration;
} }
/** /**
@ -79,7 +74,7 @@ public class LocationSettingsRequest extends AutoSafeParcelable {
* Creates a LocationSettingsRequest that can be used with SettingsApi. * Creates a LocationSettingsRequest that can be used with SettingsApi.
*/ */
public LocationSettingsRequest build() { public LocationSettingsRequest build() {
return new LocationSettingsRequest(requests, alwaysShow, needBle); return new LocationSettingsRequest(requests, alwaysShow, needBle, null);
} }
/** /**