MicroG 0.2.14.204215

This commit is contained in:
Oizaro 2020-11-19 15:56:44 +01:00
parent e5c0e26e8d
commit f403715896
192 changed files with 8562 additions and 138 deletions

View File

@ -20,7 +20,6 @@ This fork tweaks MicroG to be usable by applications that require Google authent
- Feedback
- Firebase
- Games
- Location
- Maps
- Recovery
- Registering app permissions

View File

@ -4,6 +4,7 @@
*/
buildscript {
ext.nlpVersion = '2.0-alpha4'
ext.safeParcelVersion = '1.6.0'
ext.kotlinVersion = '1.3.72'
@ -35,7 +36,7 @@ buildscript {
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.0"
classpath 'com.android.tools.build:gradle:4.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "com.squareup.wire:wire-gradle-plugin:$wireVersion"
}
@ -45,8 +46,8 @@ allprojects {
apply plugin: 'idea'
group = 'org.microg.gms'
version = "0.2.13.203916"
ext.appVersionCode = 203915002
version = "0.2.14.204215"
ext.appVersionCode = 204215001
ext.isReleaseVersion = false
}

View File

@ -37,4 +37,5 @@ dependencies {
api project(':play-services-cast-api')
api project(':play-services-cast-framework-api')
api project(':play-services-iid-api')
api project(':play-services-location-api')
}

View File

@ -0,0 +1,3 @@
package com.google.android.gms.appdatasearch;
parcelable CorpusStatus;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.appdatasearch;
parcelable PIMEUpdate;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.appdatasearch;
parcelable PIMEUpdateResponse;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.appdatasearch;
parcelable RequestIndexingSpecification;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.appdatasearch;
parcelable SuggestSpecification;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.appdatasearch;
parcelable SuggestionResults;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.appdatasearch;
parcelable UsageInfo;

View File

@ -0,0 +1,14 @@
package com.google.android.gms.appdatasearch.internal;
import com.google.android.gms.appdatasearch.CorpusStatus;
import com.google.android.gms.appdatasearch.PIMEUpdateResponse;
import com.google.android.gms.appdatasearch.RequestIndexingSpecification;
import com.google.android.gms.appdatasearch.SuggestionResults;
import com.google.android.gms.appdatasearch.SuggestSpecification;
interface IAppDataSearch {
SuggestionResults getSuggestions(String var1, String packageName, in String[] accounts, int maxNum, in SuggestSpecification specs) = 1;
boolean requestIndexing(String packageName, String accountName, long l, in RequestIndexingSpecification specs) = 3;
CorpusStatus getStatus(String packageName, String accountName) = 4;
PIMEUpdateResponse requestPIMEUpdate(String s1, String s2, int i, in byte[] bs) = 34;
}

View File

@ -0,0 +1,8 @@
package com.google.android.gms.appdatasearch.internal;
import com.google.android.gms.appdatasearch.internal.ILightweightAppDataSearchCallbacks;
import com.google.android.gms.appdatasearch.UsageInfo;
interface ILightweightAppDataSearch {
void view(ILightweightAppDataSearchCallbacks callbacks, String packageName, in UsageInfo[] usageInfos);
}

View File

@ -0,0 +1,4 @@
package com.google.android.gms.appdatasearch.internal;
interface ILightweightAppDataSearchCallbacks {
}

View File

@ -0,0 +1,5 @@
package com.google.android.gms.search.administration.internal;
interface ISearchAdministrationService {
}

View File

@ -0,0 +1,3 @@
package com.google.android.gms.search.corpora;
parcelable ClearCorpusRequest;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.search.corpora;
parcelable GetCorpusInfoRequest;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.search.corpora;
parcelable GetCorpusStatusRequest;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.search.corpora;
parcelable GetCorpusStatusResponse;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.search.corpora;
parcelable RequestIndexingRequest;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.search.corpora;
parcelable RequestIndexingResponse;

View File

@ -0,0 +1,9 @@
package com.google.android.gms.search.corpora.internal;
import com.google.android.gms.search.corpora.RequestIndexingResponse;
import com.google.android.gms.search.corpora.GetCorpusStatusResponse;
interface ISearchCorporaCallbacks {
void onRequestIndexing(in RequestIndexingResponse response) = 1;
void onGetCorpusStatus(in GetCorpusStatusResponse response) = 3;
}

View File

@ -0,0 +1,14 @@
package com.google.android.gms.search.corpora.internal;
import com.google.android.gms.search.corpora.ClearCorpusRequest;
import com.google.android.gms.search.corpora.GetCorpusStatusRequest;
import com.google.android.gms.search.corpora.GetCorpusInfoRequest;
import com.google.android.gms.search.corpora.RequestIndexingRequest;
import com.google.android.gms.search.corpora.internal.ISearchCorporaCallbacks;
interface ISearchCorporaService {
void requestIndexing(in RequestIndexingRequest request, ISearchCorporaCallbacks callbacks) = 1;
void clearCorpus(in ClearCorpusRequest request, ISearchCorporaCallbacks callbacks) = 2;
void getCorpusStatus(in GetCorpusStatusRequest request, ISearchCorporaCallbacks callbacks) = 3;
void getCorpusInfo(in GetCorpusInfoRequest request, ISearchCorporaCallbacks callbacks) = 4;
}

View File

@ -0,0 +1,3 @@
package com.google.android.gms.search.global;
parcelable GetCurrentExperimentIdsRequest;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.search.global;
parcelable GetCurrentExperimentIdsResponse;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.search.global;
parcelable GetGlobalSearchSourcesRequest;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.search.global;
parcelable GetGlobalSearchSourcesResponse;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.search.global;
parcelable GetPendingExperimentIdsRequest;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.search.global;
parcelable GetPendingExperimentIdsResponse;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.search.global;
parcelable SetExperimentIdsRequest;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.search.global;
parcelable SetExperimentIdsResponse;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.search.global;
parcelable SetIncludeInGlobalSearchRequest;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.search.global;
parcelable SetIncludeInGlobalSearchResponse;

View File

@ -0,0 +1,16 @@
package com.google.android.gms.search.global.internal;
import com.google.android.gms.search.global.GetCurrentExperimentIdsResponse;
import com.google.android.gms.search.global.GetGlobalSearchSourcesResponse;
import com.google.android.gms.search.global.GetPendingExperimentIdsResponse;
import com.google.android.gms.search.global.SetExperimentIdsResponse;
import com.google.android.gms.search.global.SetIncludeInGlobalSearchResponse;
interface IGlobalSearchAdminCallbacks {
void onGetGlobalSearchSourcesResponse(in GetGlobalSearchSourcesResponse request) = 1;
void onSetExperimentIdsResponse(in SetExperimentIdsResponse response) = 2;
void onGetCurrentExperimentIdsResponse(in GetCurrentExperimentIdsResponse response) = 3;
void onGetPendingExperimentIdsResponse(in GetPendingExperimentIdsResponse response) = 4;
void onSetIncludeInGlobalSearchResponse(in SetIncludeInGlobalSearchResponse response) = 7;
}

View File

@ -0,0 +1,17 @@
package com.google.android.gms.search.global.internal;
import com.google.android.gms.search.global.GetCurrentExperimentIdsRequest;
import com.google.android.gms.search.global.GetGlobalSearchSourcesRequest;
import com.google.android.gms.search.global.GetPendingExperimentIdsRequest;
import com.google.android.gms.search.global.SetExperimentIdsRequest;
import com.google.android.gms.search.global.SetIncludeInGlobalSearchRequest;
import com.google.android.gms.search.global.internal.IGlobalSearchAdminCallbacks;
interface IGlobalSearchAdminService {
void getGlobalSearchSources(in GetGlobalSearchSourcesRequest request, IGlobalSearchAdminCallbacks callbacks) = 1;
void setExperimentIds(in SetExperimentIdsRequest request, IGlobalSearchAdminCallbacks callbacks) = 2;
void getCurrentExperimentIds(in GetCurrentExperimentIdsRequest request, IGlobalSearchAdminCallbacks callbacks) = 3;
void getPendingExperimentIds(in GetPendingExperimentIdsRequest request, IGlobalSearchAdminCallbacks callbacks) = 4;
void setIncludeInGlobalSearch(in SetIncludeInGlobalSearchRequest request, IGlobalSearchAdminCallbacks callbacks) = 7;
}

View File

@ -0,0 +1,3 @@
package com.google.android.gms.search.queries;
parcelable QueryRequest;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.search.queries;
parcelable QueryResponse;

View File

@ -0,0 +1,7 @@
package com.google.android.gms.search.queries.internal;
import com.google.android.gms.search.queries.QueryResponse;
interface ISearchQueriesCallbacks {
void onQuery(in QueryResponse response) = 1;
}

View File

@ -0,0 +1,8 @@
package com.google.android.gms.search.queries.internal;
import com.google.android.gms.search.queries.QueryRequest;
import com.google.android.gms.search.queries.internal.ISearchQueriesCallbacks;
interface ISearchQueriesService {
void query(in QueryRequest request, ISearchQueriesCallbacks callbacks) = 1;
}

View File

@ -0,0 +1,46 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.appdatasearch;
import android.os.Bundle;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class CorpusStatus extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode;
@SafeParceled(1)
public boolean found;
@SafeParceled(2)
public long lastIndexedSeqno;
@SafeParceled(3)
public long lastCommittedSeqno;
@SafeParceled(4)
public long committedNumDocuments;
@SafeParceled(5)
public Bundle counters;
@SafeParceled(6)
public String g;
public CorpusStatus() {
versionCode = 2;
}
public static final Creator<CorpusStatus> CREATOR = new AutoCreator<CorpusStatus>(CorpusStatus.class);
}

View File

@ -0,0 +1,24 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.appdatasearch;
import org.microg.safeparcel.AutoSafeParcelable;
public class PIMEUpdate extends AutoSafeParcelable {
public static final Creator<PIMEUpdate> CREATOR = new AutoCreator<PIMEUpdate>(PIMEUpdate.class);
}

View File

@ -0,0 +1,42 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.appdatasearch;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class PIMEUpdateResponse extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode;
@SafeParceled(1)
private String b;
@SafeParceled(2)
public final byte[] bytes;
@SafeParceled(3)
public final PIMEUpdate[] updates;
public PIMEUpdateResponse() {
versionCode = 1;
this.bytes = null;
this.updates = new PIMEUpdate[0];
}
public static final Creator<PIMEUpdateResponse> CREATOR = new AutoCreator<PIMEUpdateResponse>(PIMEUpdateResponse.class);
}

View File

@ -0,0 +1,72 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.appdatasearch;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
import java.util.List;
public class QuerySpecification extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode = 2;
@SafeParceled(1)
public final boolean b;
//@SafeParceled(value = 2, subType = "TODO")
public final List c;
//@SafeParceled(value = 3, subType = "TODO")
public final List d;
@SafeParceled(4)
public final boolean e;
@SafeParceled(5)
public final int f;
@SafeParceled(6)
public final int g;
@SafeParceled(7)
public final boolean h;
@SafeParceled(8)
public final int i;
private QuerySpecification() {
b = false;
c = null;
d = null;
e = false;
f = 0;
g = 0;
h = false;
i = 0;
}
@Override
public String toString() {
return "QuerySpecification{" +
"versionCode=" + versionCode +
", b=" + b +
", c=" + c +
", d=" + d +
", e=" + e +
", f=" + f +
", g=" + g +
", h=" + h +
", i=" + i +
'}';
}
public static final Creator<QuerySpecification> CREATOR = new AutoCreator<QuerySpecification>(QuerySpecification.class);
}

View File

@ -0,0 +1,28 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.appdatasearch;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class RequestIndexingSpecification extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode;
public static final Creator<RequestIndexingSpecification> CREATOR = new AutoCreator<RequestIndexingSpecification>(RequestIndexingSpecification.class);
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.appdatasearch;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class SearchResults extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode = 2;
public static Creator<SearchResults> CREATOR = new AutoCreator<SearchResults>(SearchResults.class);
}

View File

@ -0,0 +1,31 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.appdatasearch;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class SuggestSpecification extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode;
public SuggestSpecification() {
versionCode = 2;
}
public static final Creator<SuggestSpecification> CREATOR = new AutoCreator<SuggestSpecification>(SuggestSpecification.class);
}

View File

@ -0,0 +1,54 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.appdatasearch;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class SuggestionResults extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode;
@SafeParceled(1)
public final String errorMessage;
@SafeParceled(2)
public final String[] s1;
@SafeParceled(3)
public final String[] s2;
private SuggestionResults() {
versionCode = 2;
errorMessage = null;
s1 = s2 = null;
}
public SuggestionResults(String errorMessage) {
versionCode = 2;
this.errorMessage = errorMessage;
this.s1 = null;
this.s2 = null;
}
public SuggestionResults(String[] s1, String[] s2) {
versionCode = 2;
this.errorMessage = null;
this.s1 = s1;
this.s2 = s2;
}
public static final Creator<SuggestionResults> CREATOR = new AutoCreator<SuggestionResults>(SuggestionResults.class);
}

View File

@ -0,0 +1,24 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.appdatasearch;
import org.microg.safeparcel.AutoSafeParcelable;
public class UsageInfo extends AutoSafeParcelable {
public static Creator<UsageInfo> CREATOR = new AutoCreator<UsageInfo>(UsageInfo.class);
}

View File

@ -0,0 +1,23 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.search.corpora;
import org.microg.safeparcel.AutoSafeParcelable;
public class ClearCorpusRequest extends AutoSafeParcelable {
public static Creator<ClearCorpusRequest> CREATOR = new AutoCreator<ClearCorpusRequest>(ClearCorpusRequest.class);
}

View File

@ -0,0 +1,23 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.search.corpora;
import org.microg.safeparcel.AutoSafeParcelable;
public class GetCorpusInfoRequest extends AutoSafeParcelable {
public static Creator<GetCorpusInfoRequest> CREATOR = new AutoCreator<GetCorpusInfoRequest>(GetCorpusInfoRequest.class);
}

View File

@ -0,0 +1,48 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.search.corpora;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class GetCorpusStatusRequest extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode = 1;
@SafeParceled(1)
public final String packageName;
@SafeParceled(2)
public final String corpus;
private GetCorpusStatusRequest() {
packageName = null;
corpus = null;
}
@Override
public String toString() {
return "GetCorpusStatusRequest{" +
"versionCode=" + versionCode +
", packageName='" + packageName + '\'' +
", corpus='" + corpus + '\'' +
'}';
}
public static Creator<GetCorpusStatusRequest> CREATOR = new AutoCreator<GetCorpusStatusRequest>(GetCorpusStatusRequest.class);
}

View File

@ -0,0 +1,47 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.search.corpora;
import com.google.android.gms.appdatasearch.CorpusStatus;
import com.google.android.gms.common.api.Status;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class GetCorpusStatusResponse extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode;
@SafeParceled(1)
public final Status status;
@SafeParceled(2)
public final CorpusStatus corpusStatus;
private GetCorpusStatusResponse() {
status = null;
corpusStatus = null;
}
public GetCorpusStatusResponse(Status status, CorpusStatus corpusStatus) {
this.status = status;
this.corpusStatus = corpusStatus;
}
public static Creator<GetCorpusStatusResponse> CREATOR = new AutoCreator<GetCorpusStatusResponse>(GetCorpusStatusResponse.class);
}

View File

@ -0,0 +1,53 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.search.corpora;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class RequestIndexingRequest extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode = 1;
@SafeParceled(1)
public final String packageName;
@SafeParceled(2)
public final String corpus;
@SafeParceled(3)
public final long sequenceNumber;
private RequestIndexingRequest() {
packageName = null;
corpus = null;
sequenceNumber = 0;
}
@Override
public String toString() {
return "RequestIndexingRequest{" +
"versionCode=" + versionCode +
", packageName='" + packageName + '\'' +
", corpus='" + corpus + '\'' +
", sequenceNumber=" + sequenceNumber +
'}';
}
public static Creator<RequestIndexingRequest> CREATOR = new AutoCreator<RequestIndexingRequest>(RequestIndexingRequest.class);
}

View File

@ -0,0 +1,46 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.search.corpora;
import com.google.android.gms.common.api.Status;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class RequestIndexingResponse extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode;
@SafeParceled(1)
public final Status status;
@SafeParceled(2)
public final boolean scheduledIndexing;
private RequestIndexingResponse() {
status = null;
scheduledIndexing = false;
}
public RequestIndexingResponse(Status status, boolean scheduledIndexing) {
this.status = status;
this.scheduledIndexing = scheduledIndexing;
}
public static Creator<RequestIndexingResponse> CREATOR = new AutoCreator<RequestIndexingResponse>(RequestIndexingResponse.class);
}

View File

@ -0,0 +1,28 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.search.global;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class GetCurrentExperimentIdsRequest extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode = 1;
public static final Creator<GetCurrentExperimentIdsRequest> CREATOR = new AutoCreator<GetCurrentExperimentIdsRequest>(GetCurrentExperimentIdsRequest.class);
}

View File

@ -0,0 +1,57 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.search.global;
import com.google.android.gms.common.api.Status;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
import java.util.Arrays;
public class GetCurrentExperimentIdsResponse extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode = 1;
@SafeParceled(1)
public final Status status;
@SafeParceled(2)
public final int[] experimentIds;
private GetCurrentExperimentIdsResponse() {
status = null;
experimentIds = null;
}
public GetCurrentExperimentIdsResponse(Status status, int[] experimentIds) {
this.status = status;
this.experimentIds = experimentIds;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("GetCurrentExperimentIdsResponse{");
sb.append("status=").append(status);
sb.append(", experimentIds=").append(Arrays.toString(experimentIds));
sb.append('}');
return sb.toString();
}
public static final Creator<GetCurrentExperimentIdsResponse> CREATOR = new AutoCreator<GetCurrentExperimentIdsResponse>(GetCurrentExperimentIdsResponse.class);
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.search.global;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class GetGlobalSearchSourcesRequest extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode = 1;
@SafeParceled(1)
public boolean bool;
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("GetGlobalSearchSourcesRequest{");
sb.append("bool=").append(bool);
sb.append('}');
return sb.toString();
}
public static final Creator<GetGlobalSearchSourcesRequest> CREATOR = new AutoCreator<GetGlobalSearchSourcesRequest>(GetGlobalSearchSourcesRequest.class);
}

View File

@ -0,0 +1,59 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.search.global;
import android.os.Parcelable;
import com.google.android.gms.common.api.Status;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
import java.util.Arrays;
public class GetGlobalSearchSourcesResponse extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode = 1;
@SafeParceled(1)
public final Status status;
@SafeParceled(2)
public final Parcelable[] sources;
private GetGlobalSearchSourcesResponse() {
status = null;
sources = null;
}
public GetGlobalSearchSourcesResponse(Status status, Parcelable[] sources) {
this.status = status;
this.sources = sources;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("GetGlobalSearchSourcesResponse{");
sb.append("status=").append(status);
sb.append(", sources=").append(Arrays.toString(sources));
sb.append('}');
return sb.toString();
}
public static final Creator<GetGlobalSearchSourcesResponse> CREATOR = new AutoCreator<GetGlobalSearchSourcesResponse>(GetGlobalSearchSourcesResponse.class);
}

View File

@ -0,0 +1,28 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.search.global;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class GetPendingExperimentIdsRequest extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode = 1;
public static final Creator<GetPendingExperimentIdsRequest> CREATOR = new AutoCreator<GetPendingExperimentIdsRequest>(GetPendingExperimentIdsRequest.class);
}

View File

@ -0,0 +1,57 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.search.global;
import com.google.android.gms.common.api.Status;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
import java.util.Arrays;
public class GetPendingExperimentIdsResponse extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode = 1;
@SafeParceled(1)
public final Status status;
@SafeParceled(2)
public final int[] experimentIds;
private GetPendingExperimentIdsResponse() {
status = null;
experimentIds = null;
}
public GetPendingExperimentIdsResponse(Status status, int[] experimentIds) {
this.status = status;
this.experimentIds = experimentIds;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("GetPendingExperimentIdsResponse{");
sb.append("status=").append(status);
sb.append(", experimentIds=").append(Arrays.toString(experimentIds));
sb.append('}');
return sb.toString();
}
public static final Creator<GetPendingExperimentIdsResponse> CREATOR = new AutoCreator<GetPendingExperimentIdsResponse>(GetPendingExperimentIdsResponse.class);
}

View File

@ -0,0 +1,45 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.search.global;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
import java.util.Arrays;
public class SetExperimentIdsRequest extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode = 1;
@SafeParceled(1)
public byte[] experimentIds;
@SafeParceled(2)
public boolean enable;
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("SetExperimentIdsRequest{");
sb.append("experimentIds=").append(Arrays.toString(experimentIds));
sb.append(", enable=").append(enable);
sb.append('}');
return sb.toString();
}
public static final Creator<SetExperimentIdsRequest> CREATOR = new AutoCreator<SetExperimentIdsRequest>(SetExperimentIdsRequest.class);
}

View File

@ -0,0 +1,49 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.search.global;
import com.google.android.gms.common.api.Status;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class SetExperimentIdsResponse extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode = 1;
@SafeParceled(1)
public final Status status;
private SetExperimentIdsResponse() {
status = null;
}
public SetExperimentIdsResponse(Status status) {
this.status = status;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("SetExperimentIdsResponse{");
sb.append("status=").append(status);
sb.append('}');
return sb.toString();
}
public static final Creator<SetExperimentIdsResponse> CREATOR = new AutoCreator<SetExperimentIdsResponse>(SetExperimentIdsResponse.class);
}

View File

@ -0,0 +1,47 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.search.global;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class SetIncludeInGlobalSearchRequest extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode = 1;
@SafeParceled(1)
public String packageName;
@SafeParceled(2)
public String source;
@SafeParceled(3)
public boolean enabled;
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("SetIncludeInGlobalSearchRequest{");
sb.append("packageName='").append(packageName).append('\'');
sb.append(", source='").append(source).append('\'');
sb.append(", enabled=").append(enabled);
sb.append('}');
return sb.toString();
}
public static final Creator<SetIncludeInGlobalSearchRequest> CREATOR = new AutoCreator<SetIncludeInGlobalSearchRequest>(SetIncludeInGlobalSearchRequest.class);
}

View File

@ -0,0 +1,49 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.search.global;
import com.google.android.gms.common.api.Status;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class SetIncludeInGlobalSearchResponse extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode = 1;
@SafeParceled(1)
public final Status status;
private SetIncludeInGlobalSearchResponse() {
status = null;
}
public SetIncludeInGlobalSearchResponse(Status status) {
this.status = status;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("SetIncludeInGlobalSearchResponse{");
sb.append("status=").append(status);
sb.append('}');
return sb.toString();
}
public static final Creator<SetIncludeInGlobalSearchResponse> CREATOR = new AutoCreator<SetIncludeInGlobalSearchResponse>(SetIncludeInGlobalSearchResponse.class);
}

View File

@ -0,0 +1,57 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.search.queries;
import com.google.android.gms.appdatasearch.QuerySpecification;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
import java.util.Arrays;
public class QueryRequest extends AutoSafeParcelable {
@SafeParceled(1000)
public int versionCode = 1;
@SafeParceled(1)
public String searchString;
@SafeParceled(2)
public String packageName;
@SafeParceled(3)
public String[] corpora;
@SafeParceled(4)
public int d;
@SafeParceled(5)
public int e;
@SafeParceled(6)
public QuerySpecification spec;
@Override
public String toString() {
return "QueryRequest{" +
"versionCode=" + versionCode +
", searchString='" + searchString + '\'' +
", packageName='" + packageName + '\'' +
", corpora=" + Arrays.toString(corpora) +
", d=" + d +
", e=" + e +
", spec=" + spec +
'}';
}
public static Creator<QueryRequest> CREATOR = new AutoCreator<QueryRequest>(QueryRequest.class);
}

View File

@ -0,0 +1,47 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.search.queries;
import com.google.android.gms.appdatasearch.SearchResults;
import com.google.android.gms.common.api.Status;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class QueryResponse extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode = 1;
@SafeParceled(1)
public final Status status;
@SafeParceled(2)
public final SearchResults results;
private QueryResponse() {
status = null;
results = null;
}
public QueryResponse(Status status, SearchResults results) {
this.status = status;
this.results = results;
}
public static Creator<QueryResponse> CREATOR = new AutoCreator<QueryResponse>(QueryResponse.class);
}

View File

@ -38,5 +38,5 @@ dependencies {
api project(':play-services-base-api')
implementation "androidx.fragment:fragment:$fragmentVersion"
implementation 'com.google.android.gms:play-services-base:17.4.0'
implementation 'com.google.android.gms:play-services-base:17.5.0'
}

View File

@ -122,7 +122,20 @@ public class MultiConnectionKeeper {
@SuppressLint("InlinedApi")
public void bind() {
Log.d(TAG, "Connection(" + actionString + ") : bind()");
Intent intent = new Intent(actionString).setPackage(GMS_PACKAGE_NAME);
Intent gmsIntent = new Intent(actionString).setPackage(GMS_PACKAGE_NAME);
Intent selfIntent = new Intent(actionString).setPackage(context.getPackageName());
Intent intent;
if (context.getPackageManager().resolveService(gmsIntent, 0) == null) {
Log.w(TAG, "No GMS service found for " + actionString);
if (context.getPackageManager().resolveService(selfIntent, 0) != null) {
Log.d(TAG, "Found service for "+actionString+" in self package, using it instead");
intent = selfIntent;
} else {
return;
}
} else {
intent = gmsIntent;
}
int flags = Context.BIND_AUTO_CREATE;
if (SDK_INT >= ICE_CREAM_SANDWICH) {
flags |= Context.BIND_ADJUST_WITH_ACTIVITY;

View File

@ -8,6 +8,8 @@ import com.google.android.gms.common.internal.ValidateAccountRequest;
interface IGmsServiceBroker {
void getPeopleService(IGmsCallbacks callback, int code, String str, in Bundle params) = 4;
void getReportingService(IGmsCallbacks callback, int code, String str, in Bundle params) = 5;
void getGoogleLocationManagerService(IGmsCallbacks callback, int code, String str, in Bundle params) = 7;
void getPlayLogService(IGmsCallbacks callback, int code, String str, in Bundle params) = 10;
void getCastMirroringService(IGmsCallbacks callback, int code, String str, in Bundle params) = 14;
void getGoogleIdentityService(IGmsCallbacks callback, int code, String str, in Bundle params) = 16;

View File

@ -29,6 +29,8 @@ import org.microg.safeparcel.SafeParceled;
import java.util.Arrays;
import kotlin.Suppress;
public class GetServiceRequest extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 3;

View File

@ -24,13 +24,25 @@ public enum GmsService {
CAST(10, "com.google.android.gms.cast.service.BIND_CAST_DEVICE_CONTROLLER_SERVICE"),
ADDRESS(12, "com.google.android.gms.identity.service.BIND"),
AUTH(16, "com.google.android.gms.auth.service.START"),
LIGHTWEIGHT_INDEX(19, "com.google.android.gms.icing.LIGHTWEIGHT_INDEX_SERVICE"),
INDEX(21, "com.google.android.gms.icing.INDEX_SERVICE"),
LOCATION_REPORTING(22, "com.google.android.gms.location.reporting.service.START", "com.google.android.location.reporting.service.START"),
LOCATION_MANAGER(23, "com.google.android.location.internal.GoogleLocationManagerService.START"),
PLAY_LOG(24, "com.google.android.gms.playlog.service.START"),
CAST_MIRRORING(27, "com.google.android.gms.cast_mirroring.service.START"),
SEARCH_ADMINISTRATION(30),
SEARCH_QUERIES(32),
SEARCH_GLOBAL(33),
SEARCH_CORPORA(36),
COMMON(39, "com.google.android.gms.common.service.START"),
CLEARCUT_LOGGER(40, "com.google.android.gms.clearcut.service.START"),
SIGN_IN(44, "com.google.android.gms.signin.service.START"),
CONTEXT_MANAGER(47, "com.google.android.contextmanager.service.ContextManagerService.START"),
LIGHTWEIGHT_NETWORK_QUALITY(50, "com.google.android.gms.herrevad.services.LightweightNetworkQualityAndroidService.START"),
PHENOTYPE(51, "com.mgoogle.android.gms.phenotype.service.START"),
GEODATA(65, "com.google.android.gms.location.places.GeoDataApi"),
SEARCH_IME(66),
PLACE_DETECTION(67, "com.google.android.gms.location.places.PlaceDetectionApi"),
CREDENTIALS(68, "com.google.android.gms.auth.api.credentials.service.START"),
MEASUREMENT(93, "com.google.android.gms.measurement.START"),
GASS(116, "com.google.android.gms.gass.START"),

View File

@ -19,9 +19,10 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
dependencies {
implementation "com.squareup.wire:wire-runtime:3.4.0"
implementation 'com.squareup.wire:wire-runtime:3.5.0'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'org.conscrypt:conscrypt-android:2.5.1'
implementation "org.microg.gms:conscrypt-gmscore:2.5.1"
implementation "androidx.annotation:annotation:$annotationVersion"
// TODO: Switch to upstream once raw requests are merged
// https://github.com/vitalidze/chromecast-java-api-v2/pull/99
// implementation "su.litvak.chromecast:api-v2:0.10.4"
@ -38,16 +39,21 @@ dependencies {
// AndroidX UI
implementation "androidx.appcompat:appcompat:1.2.0"
implementation "androidx.mediarouter:mediarouter:1.2.0"
implementation "androidx.preference:preference:$preferenceVersion"
implementation "androidx.preference:preference-ktx:$preferenceVersion"
implementation "androidx.navigation:navigation-fragment:2.3.1"
implementation "androidx.navigation:navigation-ui:2.3.1"
implementation "androidx.navigation:navigation-fragment-ktx:2.3.1"
implementation "androidx.navigation:navigation-ui-ktx:2.3.1"
implementation "androidx.lifecycle:lifecycle-service:$lifecycleVersion"
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10'
implementation project(path: ':play-services-basement')
// nlp
implementation "org.microg.nlp:geocode-v1:$nlpVersion"
implementation "org.microg.nlp:location-v2:$nlpVersion"
implementation "org.microg.nlp:location-v3:$nlpVersion"
implementation "org.microg.nlp:service:$nlpVersion"
api project(':play-services-location-api')
}
android {

View File

@ -12,6 +12,8 @@
-dontwarn org.slf4j.**
-dontwarn org.codehaus.jackson.**
-dontwarn com.android.location.provider.**
-dontwarn java.lang.instrument.ClassFileTransformer
-dontwarn sun.misc.SignalHandler
# Disable ProGuard Notes, they won't help here
-dontnote

View File

@ -49,8 +49,10 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
@ -264,8 +266,6 @@
</intent-filter>
</service>
<!-- microG custom UI -->
<!-- microG Settings shown in Launcher -->
<activity
android:name="org.microg.gms.ui.SettingsActivity"
@ -347,6 +347,20 @@
<!-- Other -->
<service android:name="org.microg.gms.location.GoogleLocationManagerService">
<intent-filter>
<action android:name="com.google.android.location.internal.GoogleLocationManagerService.START"/>
</intent-filter>
</service>
<service android:name="org.microg.gms.location.ReportingAndroidService">
<intent-filter>
<action android:name="com.google.android.location.reporting.service.START"/>
<action android:name="com.google.android.gms.location.reporting.service.START"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</service>
<service
android:name="org.microg.gms.measurement.MeasurementBrokerService"
android:exported="true">
@ -357,6 +371,19 @@
</intent-filter>
</service>
<service android:name="org.microg.gms.mdm.NetworkQualityService">
<intent-filter>
<action android:name="com.google.android.gms.mdm.services.START" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<service android:name="org.microg.gms.icing.LightweightIndexService">
<intent-filter>
<action android:name="com.google.android.gms.icing.LIGHTWEIGHT_INDEX_SERVICE" />
</intent-filter>
</service>
<service android:name="org.microg.gms.playlog.PlayLogService">
<intent-filter>
<action android:name="com.google.android.gms.playlog.service.START" />
@ -393,6 +420,7 @@
<action android:name="com.google.android.gms.cast_mirroring.service.START" />
<action android:name="com.google.android.gms.common.service.START" />
<action android:name="com.google.android.contextmanager.service.ContextManagerService.START" />
<action android:name="com.google.android.gms.herrevad.services.LightweightNetworkQualityAndroidService.START" />
<action android:name="com.google.android.gms.auth.api.credentials.service.START" />
<action android:name="com.google.android.gms.gass.START" />
</intent-filter>

View File

@ -1,28 +1,21 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.
* SPDX-FileCopyrightText: 2020, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.android.gms.common.security;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.os.Build;
import android.os.Process;
import android.util.Log;
import org.conscrypt.NativeCrypto;
import org.conscrypt.OpenSSLProvider;
import androidx.annotation.Keep;
import com.google.android.gms.org.conscrypt.Conscrypt;
import com.google.android.gms.org.conscrypt.NativeCrypto;
import org.microg.gms.common.PackageUtils;
import java.io.File;
@ -33,6 +26,7 @@ import java.io.OutputStream;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.security.Provider;
import java.security.Security;
import java.util.Arrays;
import java.util.Collections;
@ -44,132 +38,174 @@ import java.util.zip.ZipFile;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import static com.google.android.gms.security.ProviderInstaller.PROVIDER_NAME;
@Keep
public class ProviderInstallerImpl {
private static final String TAG = "GmsProviderInstaller";
private static final List<String> DISABLED = Collections.unmodifiableList(Arrays.asList("com.discord", "com.bankid.bus"));
private static final List<String> DISABLED = Collections.unmodifiableList(Arrays.asList("com.bankid.bus"));
public static void insertProvider(Context context) {
private static final Object lock = new Object();
private static Provider provider;
private static String getRealSelfPackageName(Context context) {
String packageName = PackageUtils.packageFromProcessId(context, Process.myPid());
Log.d(TAG, "Provider installer invoked for " + packageName);
if (packageName != null && packageName.contains(".")) return packageName;
try {
Method getBasePackageName = Context.class.getDeclaredMethod("getBasePackageName");
packageName = (String) getBasePackageName.invoke(context);
if (packageName != null) return packageName;
} catch (Exception e) {
}
if (Build.VERSION.SDK_INT >= 29) {
return context.getOpPackageName();
}
Context applicationContext = context.getApplicationContext();
if (applicationContext != null) {
return applicationContext.getPackageName();
}
return context.getPackageName();
}
@Keep
public static void insertProvider(Context context) {
String packageName = getRealSelfPackageName(context);
try {
if (DISABLED.contains(packageName)) {
Log.d(TAG, "Package is excluded from usage of provider installer");
Log.d(TAG, "Package " + packageName + " is excluded from usage of provider installer");
return;
}
if (Security.getProvider(PROVIDER_NAME) != null) {
Log.d(TAG, "Provider already inserted in " + packageName);
return;
}
OpenSSLProvider provider = null;
synchronized (lock) {
initProvider(context, packageName);
try {
provider = new OpenSSLProvider("GmsCore_OpenSSL");
} catch (UnsatisfiedLinkError e) {
Log.w(TAG, "Could not link conscrypt via default loader, trying manual loading");
// TODO: Move manual loading into helper function (as it is also used in both maps implementations)
try {
ApplicationInfo otherAppInfo = context.getPackageManager().getApplicationInfo(packageName, 0);
String primaryCpuAbi = (String) ApplicationInfo.class.getField("primaryCpuAbi").get(otherAppInfo);
if (primaryCpuAbi != null) {
String path = "lib/" + primaryCpuAbi + "/libconscrypt_jni.so";
File cacheFile = new File(context.createPackageContext(packageName, 0).getCacheDir().getAbsolutePath() + "/.gmscore/" + path);
cacheFile.getParentFile().mkdirs();
File apkFile = new File(context.getPackageCodePath());
if (!cacheFile.exists() || cacheFile.lastModified() < apkFile.lastModified()) {
ZipFile zipFile = new ZipFile(apkFile);
ZipEntry entry = zipFile.getEntry(path);
if (entry != null) {
copyInputStream(zipFile.getInputStream(entry), new FileOutputStream(cacheFile));
} else {
Log.d(TAG, "Can't load native library: " + path + " does not exist in " + apkFile);
}
}
Log.d(TAG, "Loading conscrypt_jni from " + cacheFile.getPath());
System.load(cacheFile.getAbsolutePath());
Class<NativeCrypto> clazz = NativeCrypto.class;
Field loadError = clazz.getDeclaredField("loadError");
loadError.setAccessible(true);
loadError.set(null, null);
Method clinit = clazz.getDeclaredMethod("clinit");
clinit.setAccessible(true);
Method get_cipher_names = clazz.getDeclaredMethod("get_cipher_names", String.class);
get_cipher_names.setAccessible(true);
Method cipherSuiteToJava = clazz.getDeclaredMethod("cipherSuiteToJava", String.class);
cipherSuiteToJava.setAccessible(true);
Method EVP_has_aes_hardware = clazz.getDeclaredMethod("EVP_has_aes_hardware");
EVP_has_aes_hardware.setAccessible(true);
Field f = clazz.getDeclaredField("SUPPORTED_TLS_1_2_CIPHER_SUITES_SET");
f.setAccessible(true);
Set<String> SUPPORTED_TLS_1_2_CIPHER_SUITES_SET = (Set<String>) f.get(null);
f = clazz.getDeclaredField("SUPPORTED_LEGACY_CIPHER_SUITES_SET");
f.setAccessible(true);
Set<String> SUPPORTED_LEGACY_CIPHER_SUITES_SET = (Set<String>) f.get(null);
f = clazz.getDeclaredField("SUPPORTED_TLS_1_2_CIPHER_SUITES");
f.setAccessible(true);
try {
clinit.invoke(null);
String[] allCipherSuites = (String[]) get_cipher_names.invoke(null, "ALL:!DHE");
int size = allCipherSuites.length;
String[] SUPPORTED_TLS_1_2_CIPHER_SUITES = new String[size / 2 + 2];
for (int i = 0; i < size; i += 2) {
String cipherSuite = (String) cipherSuiteToJava.invoke(null, allCipherSuites[i]);
SUPPORTED_TLS_1_2_CIPHER_SUITES[i / 2] = cipherSuite;
SUPPORTED_TLS_1_2_CIPHER_SUITES_SET.add(cipherSuite);
SUPPORTED_LEGACY_CIPHER_SUITES_SET.add(allCipherSuites[i + 1]);
}
SUPPORTED_TLS_1_2_CIPHER_SUITES[size / 2] = "TLS_EMPTY_RENEGOTIATION_INFO_SCSV";
SUPPORTED_TLS_1_2_CIPHER_SUITES[size / 2 + 1] = "TLS_FALLBACK_SCSV";
f.set(null, SUPPORTED_TLS_1_2_CIPHER_SUITES);
f = clazz.getDeclaredField("HAS_AES_HARDWARE");
f.setAccessible(true);
f.set(null, (int) EVP_has_aes_hardware.invoke(null) == 1);
provider = new OpenSSLProvider("GmsCore_OpenSSL");
} catch (InvocationTargetException inner) {
if (inner.getTargetException() instanceof UnsatisfiedLinkError) {
loadError.set(null, inner.getTargetException());
}
}
}
} catch (Exception e2) {
Log.w(TAG, e2);
if (provider == null) {
Log.w(TAG, "Failed to initialize Conscrypt");
return;
}
}
if (provider == null) {
Log.w(TAG, "Failed to initialize conscrypt provider");
return;
}
int res = Security.insertProviderAt(provider, 1);
if (res == 1) {
Security.setProperty("ssl.SocketFactory.provider", "com.google.android.gms.org.conscrypt.OpenSSLSocketFactoryImpl");
Security.setProperty("ssl.ServerSocketFactory.provider", "com.google.android.gms.org.conscrypt.OpenSSLServerSocketFactoryImpl");
if (Security.insertProviderAt(provider, 1) == 1) {
Security.setProperty("ssl.SocketFactory.provider", "org.conscrypt.OpenSSLSocketFactoryImpl");
Security.setProperty("ssl.ServerSocketFactory.provider", "org.conscrypt.OpenSSLServerSocketFactoryImpl");
SSLContext sslContext = SSLContext.getInstance("Default");
SSLContext.setDefault(sslContext);
HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
SSLContext.setDefault(SSLContext.getInstance("Default"));
HttpsURLConnection.setDefaultSSLSocketFactory(SSLContext.getDefault().getSocketFactory());
Log.d(TAG, "SSL provider installed");
} else {
Log.w(TAG, "Did not insert the new SSL provider");
Log.d(TAG, "Installed default security provider " + PROVIDER_NAME);
} else {
throw new SecurityException("Failed to install security provider " + PROVIDER_NAME + ", result: " + res);
}
}
} catch (Throwable e) {
Log.w(TAG, e);
}
}
private static void initProvider(Context context, String packageName) {
Log.d(TAG, "Initializing provider for " + packageName);
try {
provider = Conscrypt.newProviderBuilder().setName(PROVIDER_NAME).defaultTlsProtocol("TLSv1.2").build();
} catch (UnsatisfiedLinkError e) {
Log.w(TAG, "Could not link conscrypt via default loader, trying manual loading");
try {
loadConscryptDirect(context, packageName);
provider = Conscrypt.newProviderBuilder().setName(PROVIDER_NAME).defaultTlsProtocol("TLSv1.2").build();
} catch (Exception e2) {
Log.w(TAG, e2);
}
}
}
private static void loadConscryptDirect(Context context, String packageName) throws Exception {
ApplicationInfo otherAppInfo = context.getPackageManager().getApplicationInfo(packageName, 0);
// TODO: Move manual loading into helper function (as it is also used in both maps implementations)
String primaryCpuAbi = (String) ApplicationInfo.class.getField("primaryCpuAbi").get(otherAppInfo);
if (primaryCpuAbi != null) {
String path = "lib/" + primaryCpuAbi + "/libconscrypt_jni.so";
File cacheFile = new File(context.createPackageContext(packageName, 0).getCacheDir().getAbsolutePath() + "/.gmscore/" + path);
cacheFile.getParentFile().mkdirs();
File apkFile = new File(context.getPackageCodePath());
if (!cacheFile.exists() || cacheFile.lastModified() < apkFile.lastModified()) {
ZipFile zipFile = new ZipFile(apkFile);
ZipEntry entry = zipFile.getEntry(path);
if (entry != null) {
copyInputStream(zipFile.getInputStream(entry), new FileOutputStream(cacheFile));
} else {
Log.d(TAG, "Can't load native library: " + path + " does not exist in " + apkFile);
}
}
Log.d(TAG, "Loading conscrypt_jni from " + cacheFile.getPath());
System.load(cacheFile.getAbsolutePath());
Class<NativeCrypto> clazz = NativeCrypto.class;
Field loadError = clazz.getDeclaredField("loadError");
loadError.setAccessible(true);
loadError.set(null, null);
Method clinit = clazz.getDeclaredMethod("clinit");
clinit.setAccessible(true);
Method get_cipher_names = clazz.getDeclaredMethod("get_cipher_names", String.class);
get_cipher_names.setAccessible(true);
Method cipherSuiteToJava = clazz.getDeclaredMethod("cipherSuiteToJava", String.class);
cipherSuiteToJava.setAccessible(true);
Method EVP_has_aes_hardware = clazz.getDeclaredMethod("EVP_has_aes_hardware");
EVP_has_aes_hardware.setAccessible(true);
Field f = clazz.getDeclaredField("SUPPORTED_TLS_1_2_CIPHER_SUITES_SET");
f.setAccessible(true);
Set<String> SUPPORTED_TLS_1_2_CIPHER_SUITES_SET = (Set<String>) f.get(null);
f = clazz.getDeclaredField("SUPPORTED_LEGACY_CIPHER_SUITES_SET");
f.setAccessible(true);
Set<String> SUPPORTED_LEGACY_CIPHER_SUITES_SET = (Set<String>) f.get(null);
f = clazz.getDeclaredField("SUPPORTED_TLS_1_2_CIPHER_SUITES");
f.setAccessible(true);
try {
clinit.invoke(null);
String[] allCipherSuites = (String[]) get_cipher_names.invoke(null, "ALL:!DHE");
int size = allCipherSuites.length;
String[] SUPPORTED_TLS_1_2_CIPHER_SUITES = new String[size / 2 + 2];
for (int i = 0; i < size; i += 2) {
String cipherSuite = (String) cipherSuiteToJava.invoke(null, allCipherSuites[i]);
SUPPORTED_TLS_1_2_CIPHER_SUITES[i / 2] = cipherSuite;
SUPPORTED_TLS_1_2_CIPHER_SUITES_SET.add(cipherSuite);
SUPPORTED_LEGACY_CIPHER_SUITES_SET.add(allCipherSuites[i + 1]);
}
SUPPORTED_TLS_1_2_CIPHER_SUITES[size / 2] = "TLS_EMPTY_RENEGOTIATION_INFO_SCSV";
SUPPORTED_TLS_1_2_CIPHER_SUITES[size / 2 + 1] = "TLS_FALLBACK_SCSV";
f.set(null, SUPPORTED_TLS_1_2_CIPHER_SUITES);
f = clazz.getDeclaredField("HAS_AES_HARDWARE");
f.setAccessible(true);
f.set(null, (int) EVP_has_aes_hardware.invoke(null) == 1);
} catch (InvocationTargetException inner) {
if (inner.getTargetException() instanceof UnsatisfiedLinkError) {
loadError.set(null, inner.getTargetException());
}
}
}
}
private static final void copyInputStream(InputStream in, OutputStream out) throws IOException {
byte[] buffer = new byte[1024];
@ -181,4 +217,4 @@ public class ProviderInstallerImpl {
in.close();
out.close();
}
}
}

View File

@ -0,0 +1,61 @@
/*
* SPDX-FileCopyrightText: 2020, microG Project Team
* SPDX-License-Identifier: Apache-2.0
* Notice: Portions of this file are reproduced from work created and shared by Google and used
* according to terms described in the Creative Commons 4.0 Attribution License.
* See https://developers.google.com/readme/policies for details.
*/
package com.google.android.gms.security;
import android.content.Context;
import android.content.Intent;
import java.security.Provider;
/**
* A utility class for installing a dynamically updatable {@link Provider} to replace the platform default provider.
*/
public class ProviderInstaller {
public static final String PROVIDER_NAME = "GmsCore_OpenSSL";
/**
* Installs the dynamically updatable security provider, if it's not already installed.
*
* @throws GooglePlayServicesRepairableException
* @throws GooglePlayServicesNotAvailableException
*/
public static void installIfNeeded(Context context) {
}
/**
* Asynchronously installs the dynamically updatable security provider, if it's not already installed. This method must be called on the UI thread.
*
* @param context
* @param listener called when the installation completes
*/
public static void installIfNeededAsync(Context context, ProviderInstallListener listener) {
if (listener != null) listener.onProviderInstalled();
}
/**
* Callback for notification of the result of provider installation.
*/
public interface ProviderInstallListener {
/**
* Called when installing the provider fails. This method is always called on the UI thread.
* <p>
* Implementers may use {@code errorCode} with the standard UI elements provided by {@link GoogleApiAvailability}; or {@code recoveryIntent} to implement custom UI.
*
* @param errorCode error code for the failure, for use with {@link GoogleApiAvailability#showErrorDialogFragment(Activity, int, int)} or {@link GoogleApiAvailability#showErrorNotification(Context, ConnectionResult)}
* @param recoveryIntent if non-null, an intent that can be used to install or update Google Play Services such that the provider can be installed
*/
void onProviderInstallFailed(int errorCode, Intent recoveryIntent);
/**
* Called when installing the provider succeeds. This method is always called on the UI thread.
*/
void onProviderInstalled();
}
}

View File

@ -0,0 +1,74 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.mgoogle.android.gms.chimera.container;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.pm.PackageManager;
import android.os.RemoteException;
import android.util.Log;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.android.gms.dynamic.ObjectWrapper;
import com.google.android.gms.dynamite.IDynamiteLoader;
import org.microg.gms.common.Constants;
public class DynamiteLoaderImpl extends IDynamiteLoader.Stub {
private static final String TAG = "GmsDynamiteLoaderImpl";
@Override
public IObjectWrapper createModuleContext(IObjectWrapper wrappedContext, String moduleId, int minVersion) throws RemoteException {
Log.d(TAG, "unimplemented Method: createModuleContext for " + moduleId + " at version " + minVersion + ", returning gms context");
final Context context = (Context) ObjectWrapper.unwrap(wrappedContext);
try {
return ObjectWrapper.wrap(new ContextWrapper(context.createPackageContext(Constants.GMS_PACKAGE_NAME, Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY)) {
@Override
public Context getApplicationContext() {
return context;
}
});
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "returning null instead", e);
return null;
}
}
@Override
public int getModuleVersion(IObjectWrapper context, String moduleId) throws RemoteException {
return getModuleVersion2(context, moduleId, true);
}
@Override
public int getModuleVersion2(IObjectWrapper context, String moduleId, boolean updateConfigIfRequired) throws RemoteException {
if (moduleId.equals("com.google.android.gms.googlecertificates")) {
return com.google.android.gms.dynamite.descriptors.com.google.android.gms.googlecertificates.ModuleDescriptor.MODULE_VERSION;
}
if (moduleId.equals("com.google.android.gms.cast.framework.dynamite")) {
Log.d(TAG, "returning temp fix module version for " + moduleId + ". Cast API wil not be functional!");
return 1;
}
if (moduleId.equals("com.google.android.gms.maps_dynamite")) {
Log.d(TAG, "returning v1 for maps");
return 1;
}
Log.d(TAG, "unimplemented Method: getModuleVersion for " + moduleId);
return 0;
}
}

View File

@ -48,6 +48,20 @@ public abstract class AbstractGmsServiceBroker extends IGmsServiceBroker.Stub {
callGetService(GmsService.PEOPLE, callback, versionCode, packageName, params);
}
@Deprecated
@Override
public void getReportingService(IGmsCallbacks callback, int versionCode, String packageName,
Bundle params) throws RemoteException {
callGetService(GmsService.LOCATION_REPORTING, callback, versionCode, packageName, params);
}
@Deprecated
@Override
public void getGoogleLocationManagerService(IGmsCallbacks callback, int versionCode,
String packageName, Bundle params) throws RemoteException {
callGetService(GmsService.LOCATION_MANAGER, callback, versionCode, packageName, params);
}
@Deprecated
@Override
public void getPlayLogService(IGmsCallbacks callback, int versionCode, String packageName,

View File

@ -0,0 +1,64 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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 org.microg.gms.icing;
import android.os.Parcel;
import android.os.RemoteException;
import android.util.Log;
import com.google.android.gms.appdatasearch.CorpusStatus;
import com.google.android.gms.appdatasearch.PIMEUpdateResponse;
import com.google.android.gms.appdatasearch.RequestIndexingSpecification;
import com.google.android.gms.appdatasearch.SuggestSpecification;
import com.google.android.gms.appdatasearch.SuggestionResults;
import com.google.android.gms.appdatasearch.internal.IAppDataSearch;
public class AppDataSearchImpl extends IAppDataSearch.Stub {
private static final String TAG = "GmsIcingAppDataImpl";
@Override
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
if (super.onTransact(code, data, reply, flags)) return true;
Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags);
return false;
}
@Override
public SuggestionResults getSuggestions(String var1, String packageName, String[] accounts, int maxNum, SuggestSpecification specs) throws RemoteException {
return new SuggestionResults("Unknown error");
}
@Override
public boolean requestIndexing(String packageName, String accountName, long l, RequestIndexingSpecification specs) throws RemoteException {
Log.d(TAG, "requestIndexing: " + accountName + " @ " + packageName + ", " + l);
return true;
}
@Override
public CorpusStatus getStatus(String packageName, String accountName) throws RemoteException {
Log.d(TAG, "getStatus: " + accountName + " @ " + packageName);
CorpusStatus status = new CorpusStatus();
status.found = true;
return status;
}
@Override
public PIMEUpdateResponse requestPIMEUpdate(String s1, String s2, int i, byte[] bs) throws RemoteException {
Log.d(TAG, "requestPIMEUpdate: " + s1 + ", " + s2 + ", " + i + ", " + (bs == null ? "null" : new String(bs)));
return new PIMEUpdateResponse();
}
}

View File

@ -0,0 +1,77 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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 org.microg.gms.icing;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.util.Log;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.search.global.GetCurrentExperimentIdsRequest;
import com.google.android.gms.search.global.GetCurrentExperimentIdsResponse;
import com.google.android.gms.search.global.GetGlobalSearchSourcesRequest;
import com.google.android.gms.search.global.GetGlobalSearchSourcesResponse;
import com.google.android.gms.search.global.GetPendingExperimentIdsRequest;
import com.google.android.gms.search.global.GetPendingExperimentIdsResponse;
import com.google.android.gms.search.global.SetExperimentIdsRequest;
import com.google.android.gms.search.global.SetExperimentIdsResponse;
import com.google.android.gms.search.global.SetIncludeInGlobalSearchRequest;
import com.google.android.gms.search.global.SetIncludeInGlobalSearchResponse;
import com.google.android.gms.search.global.internal.IGlobalSearchAdminCallbacks;
import com.google.android.gms.search.global.internal.IGlobalSearchAdminService;
public class GlobalSearchAdminImpl extends IGlobalSearchAdminService.Stub {
private static final String TAG = "GmsIcingGlobalImpl";
@Override
public void getGlobalSearchSources(GetGlobalSearchSourcesRequest request, IGlobalSearchAdminCallbacks callbacks) throws RemoteException {
Log.d(TAG, "getGlobalSearchSources: " + request);
callbacks.onGetGlobalSearchSourcesResponse(new GetGlobalSearchSourcesResponse(Status.SUCCESS, new Parcelable[0]));
}
@Override
public void setExperimentIds(SetExperimentIdsRequest request, IGlobalSearchAdminCallbacks callbacks) throws RemoteException {
Log.d(TAG, "setExperimentIds: " + request);
callbacks.onSetExperimentIdsResponse(new SetExperimentIdsResponse(Status.SUCCESS));
}
@Override
public void getCurrentExperimentIds(GetCurrentExperimentIdsRequest request, IGlobalSearchAdminCallbacks callbacks) throws RemoteException {
Log.d(TAG, "getCurrentExperimentIds: " + request);
callbacks.onGetCurrentExperimentIdsResponse(new GetCurrentExperimentIdsResponse(Status.SUCCESS, new int[0]));
}
@Override
public void getPendingExperimentIds(GetPendingExperimentIdsRequest request, IGlobalSearchAdminCallbacks callbacks) throws RemoteException {
Log.d(TAG, "getPendingExperimentIds: " + request);
callbacks.onGetPendingExperimentIdsResponse(new GetPendingExperimentIdsResponse(Status.SUCCESS, new int[0]));
}
@Override
public void setIncludeInGlobalSearch(SetIncludeInGlobalSearchRequest request, IGlobalSearchAdminCallbacks callbacks) throws RemoteException {
Log.d(TAG, "setIncludeInGlobalSearch: " + request);
callbacks.onSetIncludeInGlobalSearchResponse(new SetIncludeInGlobalSearchResponse(Status.SUCCESS));
}
@Override
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
if (super.onTransact(code, data, reply, flags)) return true;
Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags);
return false;
}
}

View File

@ -0,0 +1,66 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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 org.microg.gms.icing;
import android.os.RemoteException;
import android.util.Log;
import com.google.android.gms.common.api.CommonStatusCodes;
import com.google.android.gms.common.internal.GetServiceRequest;
import com.google.android.gms.common.internal.IGmsCallbacks;
import org.microg.gms.BaseService;
import org.microg.gms.common.GmsService;
public class IndexService extends BaseService {
private AppDataSearchImpl appDataSearch = new AppDataSearchImpl();
private GlobalSearchAdminImpl globalSearchAdmin = new GlobalSearchAdminImpl();
private SearchCorporaImpl searchCorpora = new SearchCorporaImpl();
private SearchQueriesImpl searchQueries = new SearchQueriesImpl();
public IndexService() {
super("GmsIcingIndexSvc",
GmsService.INDEX, GmsService.SEARCH_ADMINISTRATION, GmsService.SEARCH_CORPORA,
GmsService.SEARCH_GLOBAL, GmsService.SEARCH_IME, GmsService.SEARCH_QUERIES);
}
@Override
public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException {
switch (service) {
case INDEX:
callback.onPostInitComplete(0, appDataSearch.asBinder(), null);
break;
case SEARCH_ADMINISTRATION:
Log.w(TAG, "Service not yet implemented: " + service);
callback.onPostInitComplete(CommonStatusCodes.ERROR, null, null);
break;
case SEARCH_QUERIES:
callback.onPostInitComplete(0, searchQueries.asBinder(), null);
break;
case SEARCH_GLOBAL:
callback.onPostInitComplete(0, globalSearchAdmin.asBinder(), null);
break;
case SEARCH_CORPORA:
callback.onPostInitComplete(0, searchCorpora.asBinder(), null);
break;
case SEARCH_IME:
Log.w(TAG, "Service not yet implemented: " + service);
callback.onPostInitComplete(CommonStatusCodes.ERROR, null, null);
break;
}
}
}

View File

@ -0,0 +1,42 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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 org.microg.gms.icing;
import android.os.Parcel;
import android.os.RemoteException;
import android.util.Log;
import com.google.android.gms.appdatasearch.UsageInfo;
import com.google.android.gms.appdatasearch.internal.ILightweightAppDataSearch;
import com.google.android.gms.appdatasearch.internal.ILightweightAppDataSearchCallbacks;
import java.util.Arrays;
public class LightweightAppDataSearchImpl extends ILightweightAppDataSearch.Stub {
private static final String TAG = "GmsIcingLightSearchImpl";
public void view(ILightweightAppDataSearchCallbacks callbacks, String packageName, UsageInfo[] usageInfos) {
Log.d(TAG, "view: " + Arrays.toString(usageInfos));
}
@Override
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
if (super.onTransact(code, data, reply, flags)) return true;
Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags);
return false;
}
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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 org.microg.gms.icing;
import android.os.RemoteException;
import com.google.android.gms.common.internal.GetServiceRequest;
import com.google.android.gms.common.internal.IGmsCallbacks;
import org.microg.gms.BaseService;
import org.microg.gms.common.GmsService;
public class LightweightIndexService extends BaseService {
private LightweightAppDataSearchImpl appDataSearch = new LightweightAppDataSearchImpl();
public LightweightIndexService() {
super("GmsIcingLightIndexSvc", GmsService.LIGHTWEIGHT_INDEX);
}
@Override
public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException {
callback.onPostInitComplete(0, appDataSearch.asBinder(), null);
}
}

View File

@ -0,0 +1,79 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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 org.microg.gms.icing;
import android.os.Parcel;
import android.os.RemoteException;
import android.util.Log;
import com.google.android.gms.appdatasearch.CorpusStatus;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.search.corpora.ClearCorpusRequest;
import com.google.android.gms.search.corpora.GetCorpusInfoRequest;
import com.google.android.gms.search.corpora.GetCorpusStatusRequest;
import com.google.android.gms.search.corpora.GetCorpusStatusResponse;
import com.google.android.gms.search.corpora.RequestIndexingRequest;
import com.google.android.gms.search.corpora.RequestIndexingResponse;
import com.google.android.gms.search.corpora.internal.ISearchCorporaCallbacks;
import com.google.android.gms.search.corpora.internal.ISearchCorporaService;
import java.util.HashMap;
import java.util.Map;
public class SearchCorporaImpl extends ISearchCorporaService.Stub {
private static final String TAG = "GmsIcingCorporaImpl";
// We count the sequence number here to make clients happy.
private Map<String, Long> corpusSequenceNumbers = new HashMap<String, Long>();
@Override
public void requestIndexing(RequestIndexingRequest request, ISearchCorporaCallbacks callbacks) throws RemoteException {
Log.d(TAG, "requestIndexing: " + request);
corpusSequenceNumbers.put(request.packageName + "/" + request.corpus, request.sequenceNumber);
callbacks.onRequestIndexing(new RequestIndexingResponse(Status.SUCCESS, true));
}
@Override
public void clearCorpus(ClearCorpusRequest request, ISearchCorporaCallbacks callbacks) throws RemoteException {
Log.d(TAG, "clearCorpus");
}
@Override
public void getCorpusStatus(GetCorpusStatusRequest request, ISearchCorporaCallbacks callbacks) throws RemoteException {
Log.d(TAG, "getCorpusStatus: " + request);
CorpusStatus status = new CorpusStatus();
String numIndex = request.packageName + "/" + request.corpus;
if (corpusSequenceNumbers.containsKey(numIndex)) {
status.found = true;
status.lastIndexedSeqno = corpusSequenceNumbers.get(numIndex);
status.lastCommittedSeqno = status.lastIndexedSeqno;
}
callbacks.onGetCorpusStatus(new GetCorpusStatusResponse(Status.SUCCESS, status));
}
@Override
public void getCorpusInfo(GetCorpusInfoRequest request, ISearchCorporaCallbacks callbacks) throws RemoteException {
Log.d(TAG, "getCorpusInfo");
}
@Override
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
if (super.onTransact(code, data, reply, flags)) return true;
Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags);
return false;
}
}

View File

@ -0,0 +1,44 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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 org.microg.gms.icing;
import android.os.Parcel;
import android.os.RemoteException;
import android.util.Log;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.search.queries.QueryRequest;
import com.google.android.gms.search.queries.QueryResponse;
import com.google.android.gms.search.queries.internal.ISearchQueriesCallbacks;
import com.google.android.gms.search.queries.internal.ISearchQueriesService;
public class SearchQueriesImpl extends ISearchQueriesService.Stub {
private static final String TAG = "GmsIcingQueriesImpl";
@Override
public void query(QueryRequest request, ISearchQueriesCallbacks callbacks) throws RemoteException {
Log.d(TAG, "query: " + request);
callbacks.onQuery(new QueryResponse(Status.CANCELED, null));
}
@Override
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
if (super.onTransact(code, data, reply, flags)) return true;
Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags);
return false;
}
}

View File

@ -0,0 +1,199 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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 org.microg.gms.location;
import android.Manifest;
import android.app.PendingIntent;
import android.content.Context;
import android.location.Location;
import android.location.LocationManager;
import android.os.Binder;
import android.os.RemoteException;
import com.google.android.gms.location.ILocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.internal.FusedLocationProviderResult;
import com.google.android.gms.location.internal.LocationRequestUpdateData;
import org.microg.gms.common.PackageUtils;
import org.microg.gms.common.Utils;
import java.util.ArrayList;
import java.util.List;
import static android.Manifest.permission.ACCESS_COARSE_LOCATION;
import static android.Manifest.permission.ACCESS_FINE_LOCATION;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.location.LocationManager.GPS_PROVIDER;
import static com.google.android.gms.location.LocationRequest.PRIORITY_HIGH_ACCURACY;
public class GoogleLocationManager implements LocationChangeListener {
private static final long SWITCH_ON_FRESHNESS_CLIFF_MS = 30000; // 30 seconds
private static final String ACCESS_MOCK_LOCATION = "android.permission.ACCESS_MOCK_LOCATION";
private final Context context;
private final RealLocationProvider gpsProvider;
private final MockLocationProvider mockProvider;
private final List<LocationRequestHelper> currentRequests = new ArrayList<LocationRequestHelper>();
public GoogleLocationManager(Context context) {
this.context = context;
LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
if (Utils.hasSelfPermissionOrNotify(context, Manifest.permission.ACCESS_FINE_LOCATION)) {
this.gpsProvider = new RealLocationProvider(locationManager, GPS_PROVIDER, this);
} else {
this.gpsProvider = null;
}
mockProvider = new MockLocationProvider(this);
}
public Location getLastLocation(String packageName) {
return getLocation(hasFineLocationPermission(), hasCoarseLocationPermission());
}
public Location getLocation(boolean gpsPermission, boolean networkPermission) {
if (mockProvider.getLocation() != null)
return mockProvider.getLocation();
if (gpsPermission) {
Location network = null;
Location gps = gpsProvider == null ? null : gpsProvider.getLastLocation();
if (network == null)
return gps;
if (gps == null)
return network;
if (gps.getTime() > network.getTime() - SWITCH_ON_FRESHNESS_CLIFF_MS)
return gps;
return network;
} else if (networkPermission) {
Location network = null;
if (network != null && network.getExtras() != null && network.getExtras().getParcelable("no_gps_location") instanceof Location) {
network = network.getExtras().getParcelable("no_gps_location");
}
return network;
}
return null;
}
private boolean hasCoarseLocationPermission() {
return context.checkCallingPermission(ACCESS_COARSE_LOCATION) == PERMISSION_GRANTED || hasFineLocationPermission();
}
private boolean hasFineLocationPermission() {
return context.checkCallingPermission(ACCESS_FINE_LOCATION) == PERMISSION_GRANTED;
}
private boolean hasMockLocationPermission() {
return context.checkCallingPermission(ACCESS_MOCK_LOCATION) == PERMISSION_GRANTED;
}
private void requestLocationUpdates(LocationRequestHelper request) {
LocationRequestHelper old = null;
for (LocationRequestHelper req : currentRequests) {
if (req.respondsTo(request.pendingIntent) || req.respondsTo(request.listener) || req.respondsTo(request.callback)) {
old = req;
break;
}
}
if (old != null) {
currentRequests.remove(old);
}
currentRequests.add(request);
if (gpsProvider != null && request.hasFinePermission() && request.locationRequest.getPriority() == PRIORITY_HIGH_ACCURACY) {
gpsProvider.addRequest(request);
} else if (gpsProvider != null && old != null) {
gpsProvider.removeRequest(old);
}
}
public void requestLocationUpdates(LocationRequest request, ILocationListener listener, String packageName) {
requestLocationUpdates(new LocationRequestHelper(context, request, packageName, Binder.getCallingUid(), listener));
}
public void requestLocationUpdates(LocationRequest request, PendingIntent intent, String packageName) {
requestLocationUpdates(new LocationRequestHelper(context, request, packageName, Binder.getCallingUid(), intent));
}
private void removeLocationUpdates(LocationRequestHelper request) {
currentRequests.remove(request);
if (gpsProvider != null) gpsProvider.removeRequest(request);
}
public void removeLocationUpdates(ILocationListener listener, String packageName) {
for (int i = 0; i < currentRequests.size(); i++) {
if (currentRequests.get(i).respondsTo(listener)) {
removeLocationUpdates(currentRequests.get(i));
i--;
}
}
}
public void removeLocationUpdates(PendingIntent intent, String packageName) {
for (int i = 0; i < currentRequests.size(); i++) {
if (currentRequests.get(i).respondsTo(intent)) {
removeLocationUpdates(currentRequests.get(i));
i--;
}
}
}
public void updateLocationRequest(LocationRequestUpdateData data) {
String packageName = PackageUtils.getCallingPackage(context);
if (data.pendingIntent != null)
packageName = PackageUtils.packageFromPendingIntent(data.pendingIntent);
if (data.opCode == LocationRequestUpdateData.REQUEST_UPDATES) {
requestLocationUpdates(new LocationRequestHelper(context, packageName, Binder.getCallingUid(), data));
} else if (data.opCode == LocationRequestUpdateData.REMOVE_UPDATES) {
for (int i = 0; i < currentRequests.size(); i++) {
if (currentRequests.get(i).respondsTo(data.listener)
|| currentRequests.get(i).respondsTo(data.pendingIntent)
|| currentRequests.get(i).respondsTo(data.callback)) {
removeLocationUpdates(currentRequests.get(i));
i--;
}
}
}
if (data.fusedLocationProviderCallback != null) {
try {
data.fusedLocationProviderCallback.onFusedLocationProviderResult(FusedLocationProviderResult.SUCCESS);
} catch (RemoteException ignored) {
}
}
}
public void setMockMode(boolean mockMode) {
if (!hasMockLocationPermission())
return;
mockProvider.setMockEnabled(mockMode);
}
public void setMockLocation(Location mockLocation) {
if (!hasMockLocationPermission())
return;
mockProvider.setLocation(mockLocation);
}
@Override
public void onLocationChanged() {
for (int i = 0; i < currentRequests.size(); i++) {
LocationRequestHelper request = currentRequests.get(i);
if (!request.report(getLocation(request.initialHasFinePermission, request.initialHasCoarsePermission))) {
removeLocationUpdates(request);
i--;
}
}
}
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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 org.microg.gms.location;
import android.os.RemoteException;
import android.util.Log;
import com.google.android.gms.common.internal.GetServiceRequest;
import com.google.android.gms.common.internal.IGmsCallbacks;
import org.microg.gms.BaseService;
import org.microg.gms.common.GmsService;
public class GoogleLocationManagerService extends BaseService {
private GoogleLocationManagerServiceImpl impl = new GoogleLocationManagerServiceImpl(this);
public GoogleLocationManagerService() {
super("GmsLocManagerSvc", GmsService.LOCATION_MANAGER, GmsService.GEODATA, GmsService.PLACE_DETECTION);
}
@Override
public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException {
}
}

View File

@ -0,0 +1,357 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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 org.microg.gms.location;
import android.app.PendingIntent;
import android.content.Context;
import android.location.Location;
import android.os.Binder;
import android.os.IBinder;
import android.os.Parcel;
import android.os.RemoteException;
import android.util.Log;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.location.ActivityRecognitionResult;
import com.google.android.gms.location.GeofencingRequest;
import com.google.android.gms.location.GestureRequest;
import com.google.android.gms.location.ILocationListener;
import com.google.android.gms.location.LocationAvailability;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationSettingsRequest;
import com.google.android.gms.location.LocationSettingsResult;
import com.google.android.gms.location.LocationSettingsStates;
import com.google.android.gms.location.internal.IGeofencerCallbacks;
import com.google.android.gms.location.internal.IGoogleLocationManagerService;
import com.google.android.gms.location.internal.ISettingsCallbacks;
import com.google.android.gms.location.internal.LocationRequestInternal;
import com.google.android.gms.location.internal.LocationRequestUpdateData;
import com.google.android.gms.location.internal.ParcelableGeofence;
import com.google.android.gms.location.places.AutocompleteFilter;
import com.google.android.gms.location.places.NearbyAlertRequest;
import com.google.android.gms.location.places.PlaceFilter;
import com.google.android.gms.location.places.PlaceReport;
import com.google.android.gms.location.places.PlaceRequest;
import com.google.android.gms.location.places.UserAddedPlace;
import com.google.android.gms.location.places.UserDataType;
import com.google.android.gms.location.places.internal.IPlacesCallbacks;
import com.google.android.gms.location.places.internal.PlacesParams;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import org.microg.gms.common.PackageUtils;
import java.util.Arrays;
import java.util.List;
public class GoogleLocationManagerServiceImpl extends IGoogleLocationManagerService.Stub {
private static final String TAG = "GmsLocManagerSvcImpl";
private final Context context;
private GoogleLocationManager locationManager;
public GoogleLocationManagerServiceImpl(Context context) {
this.context = context;
}
private GoogleLocationManager getLocationManager() {
if (locationManager == null)
locationManager = new GoogleLocationManager(context);
return locationManager;
}
@Override
public void addGeofencesList(List<ParcelableGeofence> geofences, PendingIntent pendingIntent,
IGeofencerCallbacks callbacks, String packageName) throws RemoteException {
Log.d(TAG, "addGeofencesList: " + geofences);
PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid());
}
@Override
public void removeGeofencesByIntent(PendingIntent pendingIntent, IGeofencerCallbacks callbacks,
String packageName) throws RemoteException {
Log.d(TAG, "removeGeofencesByIntent: " + pendingIntent);
PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid());
}
@Override
public void removeGeofencesById(String[] geofenceRequestIds, IGeofencerCallbacks callbacks,
String packageName) throws RemoteException {
Log.d(TAG, "removeGeofencesById: " + Arrays.toString(geofenceRequestIds));
PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid());
}
@Override
public void removeAllGeofences(IGeofencerCallbacks callbacks, String packageName) throws RemoteException {
Log.d(TAG, "removeAllGeofences");
PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid());
}
@Override
public void requestActivityUpdates(long detectionIntervalMillis, boolean alwaysTrue,
PendingIntent callbackIntent) throws RemoteException {
Log.d(TAG, "requestActivityUpdates: " + callbackIntent);
}
@Override
public void removeActivityUpdates(PendingIntent callbackIntent) throws RemoteException {
Log.d(TAG, "removeActivityUpdates: " + callbackIntent);
}
@Override
public ActivityRecognitionResult getLastActivity(String packageName) throws RemoteException {
Log.d(TAG, "getLastActivity");
PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid());
return null;
}
@Override
public Status iglms65(PendingIntent pendingIntent) throws RemoteException {
Log.d(TAG, "iglms65");
return null;
}
@Override
public Status iglms66(PendingIntent pendingIntent) throws RemoteException {
Log.d(TAG, "iglms66");
return null;
}
@Override
public Status requestGestureUpdates(GestureRequest request, PendingIntent pendingIntent) throws RemoteException {
Log.d(TAG, "requestGestureUpdates");
return null;
}
@Override
public Status iglms61(PendingIntent pendingIntent) throws RemoteException {
Log.d(TAG, "iglms61");
return null;
}
@Override
public Location getLastLocation() throws RemoteException {
Log.d(TAG, "getLastLocation");
return getLocationManager().getLastLocation(PackageUtils.getCallingPackage(context));
}
@Override
public void requestLocationUpdatesWithListener(LocationRequest request,
final ILocationListener listener) throws RemoteException {
Log.d(TAG, "requestLocationUpdatesWithListener: " + request);
getLocationManager().requestLocationUpdates(request, listener, PackageUtils.getCallingPackage(context));
}
@Override
public void requestLocationUpdatesWithIntent(LocationRequest request,
PendingIntent callbackIntent) throws RemoteException {
Log.d(TAG, "requestLocationUpdatesWithIntent: " + request);
getLocationManager().requestLocationUpdates(request, callbackIntent, PackageUtils.packageFromPendingIntent(callbackIntent));
}
@Override
public void removeLocationUpdatesWithListener(ILocationListener listener)
throws RemoteException {
Log.d(TAG, "removeLocationUpdatesWithListener: " + listener);
getLocationManager().removeLocationUpdates(listener, PackageUtils.getCallingPackage(context));
}
@Override
public void removeLocationUpdatesWithIntent(PendingIntent callbackIntent)
throws RemoteException {
Log.d(TAG, "removeLocationUpdatesWithIntent: " + callbackIntent);
getLocationManager().removeLocationUpdates(callbackIntent, PackageUtils.packageFromPendingIntent(callbackIntent));
}
@Override
public void updateLocationRequest(LocationRequestUpdateData locationRequestUpdateData) throws RemoteException {
Log.d(TAG, "updateLocationRequest: " + locationRequestUpdateData);
getLocationManager().updateLocationRequest(locationRequestUpdateData);
}
@Override
public void setMockMode(boolean mockMode) throws RemoteException {
Log.d(TAG, "setMockMode: " + mockMode);
getLocationManager().setMockMode(mockMode);
}
@Override
public void setMockLocation(Location mockLocation) throws RemoteException {
Log.d(TAG, "setMockLocation: " + mockLocation);
getLocationManager().setMockLocation(mockLocation);
}
@Override
public void iglms14(LatLngBounds var1, int var2, PlaceFilter var3, PlacesParams var4,
IPlacesCallbacks var5) throws RemoteException {
Log.d(TAG, "iglms14: " + var1);
}
@Override
public void iglms15(String var1, PlacesParams var2, IPlacesCallbacks var3)
throws RemoteException {
Log.d(TAG, "iglms15: " + var1);
}
@Override
public void iglms16(LatLng var1, PlaceFilter var2, PlacesParams var3, IPlacesCallbacks var4)
throws RemoteException {
Log.d(TAG, "iglms16: " + var1);
}
@Override
public void iglms17(PlaceFilter var1, PlacesParams var2, IPlacesCallbacks var3)
throws RemoteException {
Log.d(TAG, "iglms17: " + var1);
}
@Override
public void iglms18(PlaceRequest var1, PlacesParams var2, PendingIntent var3)
throws RemoteException {
Log.d(TAG, "iglms18: " + var1);
}
@Override
public void iglms19(PlacesParams var1, PendingIntent var2) throws RemoteException {
Log.d(TAG, "iglms19: " + var1);
}
@Override
public void requestLocationUpdatesWithPackage(LocationRequest request, ILocationListener listener,
String packageName) throws RemoteException {
Log.d(TAG, "requestLocationUpdatesWithPackage: " + request);
PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid());
getLocationManager().requestLocationUpdates(request, listener, packageName);
}
@Override
public Location getLastLocationWithPackage(String packageName) throws RemoteException {
Log.d(TAG, "getLastLocationWithPackage: " + packageName);
PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid());
return getLocationManager().getLastLocation(packageName);
}
@Override
public void iglms25(PlaceReport var1, PlacesParams var2) throws RemoteException {
Log.d(TAG, "iglms25: " + var1);
}
@Override
public void iglms26(Location var1, int var2) throws RemoteException {
Log.d(TAG, "iglms26: " + var1);
}
@Override
public LocationAvailability getLocationAvailabilityWithPackage(String packageName) throws RemoteException {
Log.d(TAG, "getLocationAvailabilityWithPackage: " + packageName);
PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid());
return new LocationAvailability();
}
@Override
public void iglms42(String var1, PlacesParams var2, IPlacesCallbacks var3)
throws RemoteException {
Log.d(TAG, "iglms42: " + var1);
}
@Override
public void iglms46(UserAddedPlace var1, PlacesParams var2, IPlacesCallbacks var3)
throws RemoteException {
Log.d(TAG, "iglms46: " + var1);
}
@Override
public void iglms47(LatLngBounds var1, int var2, String var3, PlaceFilter var4,
PlacesParams var5, IPlacesCallbacks var6) throws RemoteException {
Log.d(TAG, "iglms47: " + var1);
}
@Override
public void iglms48(NearbyAlertRequest var1, PlacesParams var2, PendingIntent var3)
throws RemoteException {
Log.d(TAG, "iglms48: " + var1);
}
@Override
public void iglms49(PlacesParams var1, PendingIntent var2) throws RemoteException {
Log.d(TAG, "iglms49: " + var1);
}
@Override
public void iglms50(UserDataType var1, LatLngBounds var2, List var3, PlacesParams var4,
IPlacesCallbacks var5) throws RemoteException {
Log.d(TAG, "iglms50: " + var1);
}
@Override
public IBinder iglms51() throws RemoteException {
Log.d(TAG, "iglms51");
return null;
}
@Override
public void requestLocationSettingsDialog(LocationSettingsRequest settingsRequest, ISettingsCallbacks callback, String packageName) throws RemoteException {
Log.d(TAG, "requestLocationSettingsDialog: " + settingsRequest);
PackageUtils.getAndCheckCallingPackage(context, packageName);
callback.onLocationSettingsResult(new LocationSettingsResult(new LocationSettingsStates(true, true, false, true, true, false), Status.SUCCESS));
}
@Override
public void requestLocationUpdatesInternalWithListener(LocationRequestInternal request,
ILocationListener listener) throws RemoteException {
Log.d(TAG, "requestLocationUpdatesInternalWithListener: " + request);
getLocationManager().requestLocationUpdates(request.request, listener, PackageUtils.getCallingPackage(context));
}
@Override
public void requestLocationUpdatesInternalWithIntent(LocationRequestInternal request,
PendingIntent callbackIntent) throws RemoteException {
Log.d(TAG, "requestLocationUpdatesInternalWithIntent: " + request);
getLocationManager().requestLocationUpdates(request.request, callbackIntent, PackageUtils.packageFromPendingIntent(callbackIntent));
}
@Override
public IBinder iglms54() throws RemoteException {
Log.d(TAG, "iglms54");
return null;
}
@Override
public void iglms55(String var1, LatLngBounds var2, AutocompleteFilter var3, PlacesParams var4,
IPlacesCallbacks var5) throws RemoteException {
Log.d(TAG, "iglms55: " + var1);
}
@Override
public void addGeofences(GeofencingRequest geofencingRequest, PendingIntent pendingIntent,
IGeofencerCallbacks callbacks) throws RemoteException {
Log.d(TAG, "addGeofences: " + geofencingRequest);
}
@Override
public void iglms58(List var1, PlacesParams var2, IPlacesCallbacks var3)
throws RemoteException {
Log.d(TAG, "iglms58: " + var1);
}
@Override
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
if (super.onTransact(code, data, reply, flags)) return true;
Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags);
return false;
}
}

View File

@ -0,0 +1,21 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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 org.microg.gms.location;
public interface LocationChangeListener {
public void onLocationChanged();
}

View File

@ -0,0 +1,216 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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 org.microg.gms.location;
import android.annotation.TargetApi;
import android.app.AppOpsManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Location;
import android.os.Binder;
import android.os.Build;
import android.os.RemoteException;
import android.util.Log;
import com.google.android.gms.location.ILocationCallback;
import com.google.android.gms.location.ILocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationResult;
import com.google.android.gms.location.internal.LocationRequestUpdateData;
import java.util.Arrays;
import static android.Manifest.permission.ACCESS_COARSE_LOCATION;
import static android.Manifest.permission.ACCESS_FINE_LOCATION;
public class LocationRequestHelper {
public static final String TAG = "GmsLocRequestHelper";
private final Context context;
public final LocationRequest locationRequest;
public final boolean initialHasFinePermission;
public final boolean initialHasCoarsePermission;
public final String packageName;
public final int uid;
private final boolean selfHasAppOpsRights;
public ILocationListener listener;
public PendingIntent pendingIntent;
public ILocationCallback callback;
private Location lastReport;
private int numReports = 0;
private LocationRequestHelper(Context context, LocationRequest locationRequest, String packageName, int uid) {
this.context = context;
this.locationRequest = locationRequest;
this.packageName = packageName;
this.uid = uid;
this.initialHasFinePermission = context.getPackageManager().checkPermission(ACCESS_FINE_LOCATION, packageName) == PackageManager.PERMISSION_GRANTED;
this.initialHasCoarsePermission = context.getPackageManager().checkPermission(ACCESS_COARSE_LOCATION, packageName) == PackageManager.PERMISSION_GRANTED;
this.selfHasAppOpsRights = context.getPackageManager().checkPermission("android.permission.UPDATE_APP_OPS_STATS", context.getPackageName()) == PackageManager.PERMISSION_GRANTED;
}
public LocationRequestHelper(Context context, LocationRequest locationRequest, String packageName, int uid, ILocationListener listener) {
this(context, locationRequest, packageName, uid);
this.listener = listener;
}
public LocationRequestHelper(Context context, LocationRequest locationRequest, String packageName, int uid, PendingIntent pendingIntent) {
this(context, locationRequest, packageName, uid);
this.pendingIntent = pendingIntent;
}
public LocationRequestHelper(Context context, String packageName, int uid, LocationRequestUpdateData data) {
this(context, data.request.request, packageName, uid);
this.listener = data.listener;
this.pendingIntent = data.pendingIntent;
this.callback = data.callback;
}
/**
* @return whether to continue sending reports to this {@link LocationRequestHelper}
*/
public boolean report(Location location) {
if (location == null) return true;
if (!hasCoarsePermission()) return false;
if (lastReport != null) {
if (location.getTime() - lastReport.getTime() < locationRequest.getFastestInterval()) {
return true;
}
if (location.distanceTo(lastReport) < locationRequest.getSmallestDesplacement()) {
return true;
}
}
lastReport = new Location(location);
lastReport.setProvider("fused");
Log.d(TAG, "sending Location: " + location + " to " + packageName);
if (listener != null) {
try {
listener.onLocationChanged(lastReport);
} catch (RemoteException e) {
return false;
}
} else if (pendingIntent != null) {
Intent intent = new Intent();
intent.putExtra("com.google.android.location.LOCATION", lastReport);
try {
pendingIntent.send(context, 0, intent);
} catch (PendingIntent.CanceledException e) {
return false;
}
} else if (callback != null) {
try {
callback.onLocationResult(LocationResult.create(Arrays.asList(lastReport)));
} catch (RemoteException e) {
return false;
}
}
numReports++;
return numReports < locationRequest.getNumUpdates();
}
@Override
public String toString() {
return "LocationRequestHelper{" +
"locationRequest=" + locationRequest +
", hasFinePermission=" + hasFinePermission() +
", hasCoarsePermission=" + hasCoarsePermission() +
", packageName='" + packageName + '\'' +
", lastReport=" + lastReport +
'}';
}
public boolean respondsTo(ILocationListener listener) {
return this.listener != null && listener != null &&
this.listener.asBinder().equals(listener.asBinder());
}
public boolean respondsTo(ILocationCallback callback) {
return this.callback != null && callback != null &&
this.callback.asBinder().equals(callback.asBinder());
}
public boolean respondsTo(PendingIntent pendingIntent) {
return this.pendingIntent != null && this.pendingIntent.equals(pendingIntent);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
LocationRequestHelper that = (LocationRequestHelper) o;
if (!locationRequest.equals(that.locationRequest)) return false;
if (packageName != null ? !packageName.equals(that.packageName) : that.packageName != null) return false;
if (listener != null ? !listener.equals(that.listener) : that.listener != null) return false;
if (pendingIntent != null ? !pendingIntent.equals(that.pendingIntent) : that.pendingIntent != null)
return false;
return !(callback != null ? !callback.equals(that.callback) : that.callback != null);
}
public boolean hasFinePermission() {
if (Build.VERSION.SDK_INT >= 19) {
return isAppOpsAllowed(AppOpsManager.OPSTR_FINE_LOCATION, initialHasFinePermission);
} else {
return initialHasFinePermission;
}
}
public boolean hasCoarsePermission() {
if (Build.VERSION.SDK_INT >= 19) {
return isAppOpsAllowed(AppOpsManager.OPSTR_COARSE_LOCATION, initialHasCoarsePermission);
} else {
return initialHasCoarsePermission;
}
}
@TargetApi(19)
private boolean isAppOpsAllowed(String op, boolean def) {
AppOpsManager appOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
if (appOpsManager == null) return def;
try {
if (Binder.getCallingUid() == uid && Build.VERSION.SDK_INT >= 23) {
return appOpsManager.noteProxyOpNoThrow(op, packageName) == AppOpsManager.MODE_ALLOWED;
} else if (Build.VERSION.SDK_INT >= 29) {
return appOpsManager.noteProxyOpNoThrow(op, packageName, uid) == AppOpsManager.MODE_ALLOWED;
} else if (selfHasAppOpsRights) {
return appOpsManager.noteOpNoThrow(op, uid, packageName) == AppOpsManager.MODE_ALLOWED;
} else {
// TODO: More variant that works pre-29 and without perms?
Log.w(TAG, "Can't check appops (yet)");
return def;
}
} catch (Exception e) {
Log.w(TAG, e);
return def;
}
}
@Override
public int hashCode() {
int result = locationRequest.hashCode();
result = 31 * result + (packageName != null ? packageName.hashCode() : 0);
result = 31 * result + (listener != null ? listener.hashCode() : 0);
result = 31 * result + (pendingIntent != null ? pendingIntent.hashCode() : 0);
result = 31 * result + (callback != null ? callback.hashCode() : 0);
return result;
}
}

View File

@ -0,0 +1,49 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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 org.microg.gms.location;
import android.location.Location;
import android.os.Bundle;
import static org.microg.gms.location.LocationConstants.KEY_MOCK_LOCATION;
public class MockLocationProvider {
private boolean mockEnabled = false;
private Location mockLocation = null;
private final LocationChangeListener changeListener;
public MockLocationProvider(LocationChangeListener changeListener) {
this.changeListener = changeListener;
}
public void setMockEnabled(boolean mockEnabled) {
this.mockEnabled = mockEnabled;
}
public Location getLocation() {
return mockEnabled ? mockLocation : null;
}
public void setLocation(Location mockLocation) {
if (mockLocation.getExtras() == null) {
mockLocation.setExtras(new Bundle());
}
mockLocation.getExtras().putBoolean(KEY_MOCK_LOCATION, false);
this.mockLocation = mockLocation;
this.changeListener.onLocationChanged();
}
}

View File

@ -0,0 +1,149 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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 org.microg.gms.location;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.Looper;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
@SuppressWarnings("MissingPermission")
public class RealLocationProvider {
public static final String TAG = "GmsLocProviderReal";
private static final int MIN_GPS_TIME = 10000;
private final LocationManager locationManager;
private final String name;
private final AtomicBoolean connected = new AtomicBoolean(false);
private final LocationChangeListener changeListener;
private long connectedMinTime;
private float connectedMinDistance;
private Location lastLocation;
private final List<LocationRequestHelper> requests = new ArrayList<LocationRequestHelper>();
private LocationListener listener = new LocationListener() {
@Override
public void onLocationChanged(Location location) {
lastLocation = location;
changeListener.onLocationChanged();
}
@Override
public void onStatusChanged(String s, int i, Bundle bundle) {
}
@Override
public void onProviderEnabled(String s) {
}
@Override
public void onProviderDisabled(String s) {
}
};
public RealLocationProvider(LocationManager locationManager, String name, LocationChangeListener changeListener) {
this.locationManager = locationManager;
this.name = name;
this.changeListener = changeListener;
updateLastLocation();
}
private void updateLastLocation() {
Location newLocation = locationManager.getLastKnownLocation(name);
if (newLocation != null) lastLocation = newLocation;
}
public void invokeOnceReady(Runnable runnable) {
// Always ready
runnable.run();
}
public Location getLastLocation() {
if (!connected.get()) {
updateLastLocation();
}
if (lastLocation == null) {
Log.d(TAG, "uh-ok: last location for " + name + " is null!");
}
return lastLocation;
}
public void addRequest(LocationRequestHelper request) {
Log.d(TAG, name + ": addRequest " + request);
for (int i = 0; i < requests.size(); i++) {
LocationRequestHelper req = requests.get(i);
if (req.respondsTo(request.pendingIntent) || req.respondsTo(request.listener) || req.respondsTo(request.callback)) {
requests.remove(i);
i--;
}
}
requests.add(request);
updateConnection();
}
public void removeRequest(LocationRequestHelper request) {
Log.d(TAG, name + ": removeRequest " + request);
requests.remove(request);
updateConnection();
}
private synchronized void updateConnection() {
if (connected.get() && requests.isEmpty()) {
Log.d(TAG, name + ": no longer requesting location update");
locationManager.removeUpdates(listener);
connected.set(false);
} else if (!requests.isEmpty()) {
long minTime = Long.MAX_VALUE;
float minDistance = Float.MAX_VALUE;
StringBuilder sb = new StringBuilder();
for (LocationRequestHelper request : requests) {
minTime = Math.min(request.locationRequest.getInterval(), minTime);
minDistance = Math.min(request.locationRequest.getSmallestDesplacement(), minDistance);
if (sb.length() != 0) sb.append(", ");
sb.append(request.packageName).append(":").append(request.locationRequest.getInterval()).append("ms");
}
if (minTime > MIN_GPS_TIME && name.equals("gps")) {
Log.d(TAG, name + ": ignoring request as " + minTime + "ms (" + sb + "), is less than " + MIN_GPS_TIME);
locationManager.removeUpdates(listener);
connected.set(false);
return;
}
Log.d(TAG, name + ": requesting location updates with interval " + minTime + "ms (" + sb + "), minDistance=" + minDistance);
if (connected.get()) {
if (connectedMinTime != minTime || connectedMinDistance != minDistance) {
locationManager.removeUpdates(listener);
locationManager.requestLocationUpdates(name, minTime, minDistance, listener,
Looper.getMainLooper());
}
} else {
locationManager.requestLocationUpdates(name, minTime, minDistance, listener, Looper.getMainLooper());
}
connected.set(true);
connectedMinTime = minTime;
connectedMinDistance = minDistance;
}
}
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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 org.microg.gms.location;
import android.os.RemoteException;
import com.google.android.gms.common.internal.GetServiceRequest;
import com.google.android.gms.common.internal.IGmsCallbacks;
import org.microg.gms.BaseService;
import org.microg.gms.common.GmsService;
public class ReportingAndroidService extends BaseService {
private ReportingServiceImpl reportingService = new ReportingServiceImpl();
public ReportingAndroidService() {
super("GmsLocReportingSvc", GmsService.LOCATION_REPORTING);
}
@Override
public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException {
callback.onPostInitComplete(0, reportingService.asBinder(), null);
}
}

View File

@ -0,0 +1,61 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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 org.microg.gms.location;
import android.accounts.Account;
import android.os.RemoteException;
import android.util.Log;
import com.google.android.gms.location.places.PlaceReport;
import com.google.android.gms.location.reporting.ReportingState;
import com.google.android.gms.location.reporting.UploadRequest;
import com.google.android.gms.location.reporting.UploadRequestResult;
import com.google.android.gms.location.reporting.internal.IReportingService;
public class ReportingServiceImpl extends IReportingService.Stub {
private static final String TAG = "GmsLocReportSvcImpl";
@Override
public ReportingState getReportingState(Account account) throws RemoteException {
Log.d(TAG, "getReportingState");
return new ReportingState();
}
@Override
public int tryOptIn(Account account) throws RemoteException {
Log.d(TAG, "tryOptIn");
return 0;
}
@Override
public UploadRequestResult requestUpload(UploadRequest request) throws RemoteException {
Log.d(TAG, "requestUpload");
return new UploadRequestResult();
}
@Override
public int cancelUploadRequest(long l) throws RemoteException {
Log.d(TAG, "cancelUploadRequest");
return 0;
}
@Override
public int reportDeviceAtPlace(Account account, PlaceReport report) throws RemoteException {
Log.d(TAG, "reportDeviceAtPlace");
return 0;
}
}

View File

@ -0,0 +1,32 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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 org.microg.gms.mdm;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;
public class NetworkQualityService extends Service {
private static final String TAG = "GmsMdmQualitySvc";
@Override
public IBinder onBind(Intent intent) {
Log.d(TAG, "onBind: " + intent);
return null;
}
}

View File

@ -19,7 +19,7 @@
Se ciò è intenzionale, utilizza il pulsante <b>Accedi</b> (o <b>Huawei</b>, se possiedi un dispositivo con questo marchio) per connetterti alla relativa pagina di accesso Google, in caso contrario, premi <b>Annulla</b> per tornare all\'applicazione che ha richiamato questa finestra di dialogo."</string>
<string name="auth_sign_in">Accedi</string>
<string name="auth_connecting">"Il tuo dispositivo sta stabilendo una connessione ai server di Google per eseguire l\'accesso.
<string name="auth_connecting">"Il tuo dispositivo sta stabilendo una connessione con i server di Google per eseguire l\'accesso.
Questa operazione potrebbe richiedere alcuni secondi."</string>
<string name="no_network_error_desc">"Non è stata rilevata alcuna connessione di rete.

View File

@ -0,0 +1,39 @@
/*
* Copyright 2013-2015 microG Project Team
*
* 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.
*/
apply plugin: 'com.android.library'
android {
compileSdkVersion androidCompileSdk
buildToolsVersion "$androidBuildVersionTools"
defaultConfig {
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
dependencies {
api project(':play-services-basement')
api project(':play-services-base-api')
}

View File

@ -0,0 +1,34 @@
#
# Copyright 2013-2016 microG Project Team
#
# 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.
#
POM_NAME=Play Services Internal Location API
POM_DESCRIPTION=Interfaces and objects for IPC between Play Services Library and Play Services Core
POM_PACKAGING=aar
POM_URL=https://github.com/microg/android_external_GmsApi
POM_SCM_URL=https://github.com/microg/android_external_GmsApi
POM_SCM_CONNECTION=scm:git@github.com:microg/android_external_GmsApi.git
POM_SCM_DEV_CONNECTION=scm:git@github.com:microg/android_external_GmsApi.git
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=mar-v-in
POM_DEVELOPER_NAME=Marvin W

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2013-2017 microG Project Team
~
~ 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.
-->
<manifest package="org.microg.gms.location.api"/>

View File

@ -0,0 +1,3 @@
package com.google.android.gms.location;
parcelable ActivityRecognitionResult;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.location;
parcelable GeofencingRequest;

Some files were not shown because too many files have changed in this diff Show More