-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be20546
commit dc6daaa
Showing
10 changed files
with
451 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
play-services-base/src/main/aidl/com/google/android/gms/potokens/PoToken.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.google.android.gms.potokens; | ||
|
||
parcelable PoToken; |
11 changes: 11 additions & 0 deletions
11
...ervices-base/src/main/aidl/com/google/android/gms/potokens/internal/IPoTokensService.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.google.android.gms.potokens.internal; | ||
|
||
import com.google.android.gms.common.api.internal.IStatusCallback; | ||
import com.google.android.gms.potokens.internal.ITokenCallbacks; | ||
|
||
interface IPoTokensService{ | ||
|
||
void responseStatus(IStatusCallback call,in int code)=1; | ||
|
||
void responseStatusToken(ITokenCallbacks call, in int code, in byte[] data)=2; | ||
} |
8 changes: 8 additions & 0 deletions
8
...services-base/src/main/aidl/com/google/android/gms/potokens/internal/ITokenCallbacks.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.google.android.gms.potokens.internal; | ||
|
||
import com.google.android.gms.common.api.Status; | ||
import com.google.android.gms.potokens.PoToken; | ||
|
||
interface ITokenCallbacks{ | ||
void responseToken(in Status status,in PoToken token)=1; | ||
} |
15 changes: 15 additions & 0 deletions
15
play-services-base/src/main/java/com/google/android/gms/potokens/PoToken.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.google.android.gms.potokens; | ||
|
||
import org.microg.safeparcel.AutoSafeParcelable; | ||
|
||
public class PoToken extends AutoSafeParcelable { | ||
|
||
@Field(1) | ||
public byte[] data; | ||
|
||
public PoToken(byte[] data) { | ||
this.data = data; | ||
} | ||
|
||
public static Creator<PoToken> CREATOR = new AutoCreator<>(PoToken.class); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
option java_package = "com.google.android.gms.potokens"; | ||
|
||
option java_multiple_files = true; | ||
|
||
message CipherKey { | ||
optional int32 key = 1; | ||
optional bytes value = 3; | ||
} | ||
|
||
message KeyData { | ||
optional string typeUrl = 1; | ||
optional CipherKey value = 2; | ||
optional int32 keyMaterialType = 3; | ||
} | ||
|
||
message Key { | ||
optional KeyData data = 1; | ||
optional int32 status = 2; | ||
optional int32 keyId = 3; | ||
optional int32 outputPrefixType = 4; | ||
} | ||
|
||
message KeySet { | ||
optional int32 primaryKeyId = 1; | ||
repeated Key keyList = 2; | ||
} | ||
|
||
message PoTokenInfo { | ||
optional int32 time = 1; | ||
optional bytes inputData = 2; | ||
optional string pkgName = 3; | ||
optional bytes pkgSignSha256 = 4; | ||
optional bytes piTokenData = 5; | ||
optional int32 key = 6; | ||
} | ||
|
||
message GetPoIntegrityTokenRequest { | ||
optional int32 mode = 1; | ||
optional bytes dgResult = 2; | ||
optional bytes dgRandKey = 3; | ||
} | ||
|
||
message GetPoIntegrityTokenResponse { | ||
optional bytes desc = 1; | ||
optional int32 code = 2; | ||
optional bytes backup = 3; | ||
optional bytes piTokenData = 4; | ||
optional bytes poTokenData = 5; | ||
} | ||
|
||
message PoTokenResult { | ||
optional bytes encryptData = 1; | ||
optional bytes piTokenData = 2; | ||
} | ||
|
||
message PoTokenResultWrap { | ||
optional PoTokenResult data = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...vices-core/src/main/kotlin/com/google/android/gms/potokens/internal/PoTokensApiService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.google.android.gms.potokens.internal | ||
|
||
import android.os.RemoteException | ||
import android.util.Log | ||
import com.google.android.gms.common.Feature | ||
import com.google.android.gms.common.api.CommonStatusCodes | ||
import com.google.android.gms.common.internal.ConnectionInfo | ||
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 | ||
|
||
const val TAG = "PoTokensApi" | ||
|
||
class PoTokensApiService : BaseService(TAG, GmsService.POTOKENS) { | ||
@Throws(RemoteException::class) | ||
override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) { | ||
val connectionInfo = ConnectionInfo() | ||
connectionInfo.features = arrayOf(Feature("PO_TOKENS", 1)) | ||
Log.d(TAG,"PoTokensApiService handleServiceRequest") | ||
callback.onPostInitCompleteWithConnectionInfo( | ||
CommonStatusCodes.SUCCESS, PoTokensApiServiceImpl( | ||
applicationContext, request.packageName | ||
), connectionInfo | ||
) | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...s-core/src/main/kotlin/com/google/android/gms/potokens/internal/PoTokensApiServiceImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.google.android.gms.potokens.internal | ||
|
||
import android.content.Context | ||
import android.os.RemoteException | ||
import android.util.Log | ||
import com.google.android.gms.common.api.Status | ||
import com.google.android.gms.common.api.internal.IStatusCallback | ||
import com.google.android.gms.potokens.PoToken | ||
import com.google.android.gms.potokens.utils.PoTokenHelper | ||
|
||
class PoTokensApiServiceImpl(private val context: Context, private val packageName: String) : | ||
IPoTokensService.Stub() { | ||
|
||
@Throws(RemoteException::class) | ||
override fun responseStatus(call: IStatusCallback, code: Int) { | ||
Log.d(TAG, "responseStatus this is success") | ||
call.onResult(Status.SUCCESS) | ||
} | ||
|
||
@Throws(RemoteException::class) | ||
override fun responseStatusToken(call: ITokenCallbacks, i: Int, bArr: ByteArray) { | ||
Log.d(TAG, "responseStatusToken this is packageName,$packageName") | ||
|
||
val poTokenHelper = PoTokenHelper() | ||
val bytes = poTokenHelper.callPoToken(context, packageName, bArr) | ||
Log.d(TAG, "responseStatusToken this is result," + bytes.size) | ||
|
||
call.responseToken(Status.SUCCESS, PoToken(bytes)) | ||
Log.d(TAG, "responseStatusToken this is result end") | ||
} | ||
|
||
} |
Oops, something went wrong.