Add SafetyNet API

This commit is contained in:
Marvin W 2016-09-16 23:05:21 +02:00
parent 351a4b8615
commit 18da23b482
No known key found for this signature in database
GPG Key ID: 072E9235DB996F2A
8 changed files with 131 additions and 0 deletions

View File

@ -0,0 +1,3 @@
package com.google.android.gms.safetynet;
parcelable AttestationData;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.safetynet;
parcelable HarmfulAppsData;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.safetynet;
parcelable SafeBrowsingData;

View File

@ -0,0 +1,14 @@
package com.google.android.gms.safetynet.internal;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.safetynet.AttestationData;
import com.google.android.gms.safetynet.HarmfulAppsData;
import com.google.android.gms.safetynet.SafeBrowsingData;
interface ISafetyNetCallbacks {
void onAttestationData(in Status status, in AttestationData attestationData) = 0;
void onString(String s) = 1;
void onSafeBrowsingData(in Status status, in SafeBrowsingData safeBrowsingData) = 2;
void onBoolean(in Status status, boolean b) = 3;
void onHarmfulAppsData(in Status status, in List<HarmfulAppsData> harmfulAppsData) = 4;
}

View File

@ -0,0 +1,11 @@
package com.google.android.gms.safetynet.internal;
import com.google.android.gms.safetynet.internal.ISafetyNetCallbacks;
interface ISafetyNetService {
void attest(ISafetyNetCallbacks callbacks, in byte[] nonce) = 0;
void getSharedUuid(ISafetyNetCallbacks callbacks) = 1;
void lookupUri(ISafetyNetCallbacks callbacks, String s1, in int[] threatTypes, int i, String s2) = 2;
void init(ISafetyNetCallbacks callbacks) = 3;
void unknown4(ISafetyNetCallbacks callbacks) = 4;
}

View File

@ -0,0 +1,41 @@
/*
* 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.
*/
package com.google.android.gms.safetynet;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class AttestationData extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
private final String jwsResult;
private AttestationData() {
jwsResult = null;
}
public AttestationData(String jwsResult) {
this.jwsResult = jwsResult;
}
public String getJwsResult() {
return jwsResult;
}
public static final Creator<AttestationData> CREATOR = new AutoCreator<AttestationData>(AttestationData.class);
}

View File

@ -0,0 +1,23 @@
/*
* 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.
*/
package com.google.android.gms.safetynet;
import org.microg.safeparcel.AutoSafeParcelable;
public class HarmfulAppsData extends AutoSafeParcelable {
public static final Creator<HarmfulAppsData> CREATOR = new AutoCreator<HarmfulAppsData>(HarmfulAppsData.class);
}

View File

@ -0,0 +1,33 @@
/*
* 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.
*/
package com.google.android.gms.safetynet;
import com.google.android.gms.common.data.DataHolder;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class SafeBrowsingData extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
private String status;
@SafeParceled(3)
private DataHolder data;
public static final Creator<SafeBrowsingData> CREATOR = new AutoCreator<SafeBrowsingData>(SafeBrowsingData.class);
}