Skip to content

Commit

Permalink
Mark oneway functions as oneway in aidl
Browse files Browse the repository at this point in the history
  • Loading branch information
mar-v-in committed Aug 20, 2021
1 parent 60d26b8 commit 2e286a7
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import com.google.firebase.auth.api.internal.GetTokenResponse;
import com.google.firebase.auth.api.internal.ResetPasswordResponse;

interface IFirebaseAuthCallbacks {
void onGetTokenResponse(in GetTokenResponse response) = 0;
void onGetTokenResponseAndUser(in GetTokenResponse response, in GetAccountInfoUser user) = 1;
void onCreateAuthUriResponse(in CreateAuthUriResponse response) = 2;
void onResetPasswordResponse(in ResetPasswordResponse response) = 3;
void onFailure(in Status status) = 4;
void onDeleteAccountResponse() = 5;
void onEmailVerificationResponse() = 6;

void onSendVerificationCodeResponse(String sessionInfo) = 8;
void onVerificationCompletedResponse(in PhoneAuthCredential credential) = 9;
void onVerificationAutoTimeOut(String sessionInfo) = 10;
oneway void onGetTokenResponse(in GetTokenResponse response) = 0;
oneway void onGetTokenResponseAndUser(in GetTokenResponse response, in GetAccountInfoUser user) = 1;
oneway void onCreateAuthUriResponse(in CreateAuthUriResponse response) = 2;
oneway void onResetPasswordResponse(in ResetPasswordResponse response) = 3;
oneway void onFailure(in Status status) = 4;
oneway void onDeleteAccountResponse() = 5;
oneway void onEmailVerificationResponse() = 6;
//oneway void onSetAccountInfo(String s) = 7
oneway void onSendVerificationCodeResponse(String sessionInfo) = 8;
oneway void onVerificationCompletedResponse(in PhoneAuthCredential credential) = 9;
oneway void onVerificationAutoTimeOut(String sessionInfo) = 10;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import com.google.android.gms.common.api.Status;
import com.google.android.gms.phenotype.Configurations;

interface IPhenotypeCallbacks {
void onRegister(in Status status) = 0;
void onConfigurations(in Status status, in Configurations configurations) = 3;
oneway void onRegister(in Status status) = 0;
oneway void onConfigurations(in Status status, in Configurations configurations) = 3;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import com.google.android.gms.safetynet.RemoveHarmfulAppData;
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;
void onRecaptchaResult(in Status status, in RecaptchaResultData recaptchaResultData) = 5;
void onHarmfulAppsInfo(in Status status, in HarmfulAppsInfo harmfulAppsInfo) = 7;
void onRemoveHarmfulAppData(in Status status, in RemoveHarmfulAppData removeHarmfulAppData) = 14;
oneway void onAttestationData(in Status status, in AttestationData attestationData) = 0;
oneway void onString(String s) = 1;
oneway void onSafeBrowsingData(in Status status, in SafeBrowsingData safeBrowsingData) = 2;
oneway void onBoolean(in Status status, boolean b) = 3;
oneway void onHarmfulAppsData(in Status status, in List<HarmfulAppsData> harmfulAppsData) = 4;
oneway void onRecaptchaResult(in Status status, in RecaptchaResultData recaptchaResultData) = 5;
oneway void onHarmfulAppsInfo(in Status status, in HarmfulAppsInfo harmfulAppsInfo) = 7;
oneway void onRemoveHarmfulAppData(in Status status, in RemoveHarmfulAppData removeHarmfulAppData) = 14;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* SPDX-FileCopyrightText: 2021, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package org.microg.gms.utils

import android.os.Binder
import android.os.Parcel
import android.util.Log

fun warnOnTransactionIssues(tag: String, code: Int, reply: Parcel?, flags: Int, base: () -> Boolean): Boolean {
if (base.invoke()) {
if ((flags and Binder.FLAG_ONEWAY) > 0 && (reply?.dataSize() ?: 0) > 0) {
Log.w(tag, "onTransact[$code] is oneway, but returned data")
}
return true
}
Log.w(tag, "onTransact[$code] is not processed.")
return (flags and Binder.FLAG_ONEWAY) > 0 // Don't return false on oneway transaction to suppress warning
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import com.google.android.gms.cast.LaunchOptions;
import com.google.android.gms.cast.JoinOptions;

interface ICastDeviceController {
void disconnect() = 0;
void stopApplication(String sessionId) = 4;
void sendMessage(String namespace, String message, long requestId) = 8;
void registerNamespace(String namespace) = 10;
void unregisterNamespace(String namespace) = 11;
void launchApplication(String applicationId, in LaunchOptions launchOptions) = 12;
void joinApplication(String applicationId, String sessionId, in JoinOptions joinOptions) = 13;
oneway void disconnect() = 0;
oneway void stopApplication(String sessionId) = 4;
oneway void sendMessage(String namespace, String message, long requestId) = 8;
oneway void registerNamespace(String namespace) = 10;
oneway void unregisterNamespace(String namespace) = 11;
oneway void launchApplication(String applicationId, in LaunchOptions launchOptions) = 12;
oneway void joinApplication(String applicationId, String sessionId, in JoinOptions joinOptions) = 13;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@

package org.microg.gms.droidguard

import android.os.ParcelFileDescriptor
import com.google.android.gms.droidguard.internal.DroidGuardResultsRequest
import com.google.android.gms.droidguard.internal.IDroidGuardHandle

class DroidGuardHandle(private val handle: IDroidGuardHandle) {
private var state = 0
var fd: ParcelFileDescriptor? = null

fun init(flow: String) {
if (state != 0) throw IllegalStateException("init() already called")
try {
handle.initWithRequest(flow, DroidGuardResultsRequest().setOpenHandles(openHandles++))
handle.initWithRequest(flow, DroidGuardResultsRequest().setOpenHandles(openHandles++).also { fd?.let { fd -> it.fd = fd } })
state = 1
} catch (e: Exception) {
state = -1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package com.google.android.gms.location.internal;
import com.google.android.gms.location.internal.FusedLocationProviderResult;

interface IFusedLocationProviderCallback {
void onFusedLocationProviderResult(in FusedLocationProviderResult result) = 0;
oneway void onFusedLocationProviderResult(in FusedLocationProviderResult result) = 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ package com.google.android.gms.nearby.exposurenotification.internal;
import com.google.android.gms.common.api.Status;

interface IBooleanCallback {
void onResult(in Status status, boolean result);
oneway void onResult(in Status status, boolean result);
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,26 @@ import com.google.android.gms.nearby.exposurenotification.internal.RequestPreAut
import com.google.android.gms.nearby.exposurenotification.internal.RequestPreAuthorizedTemporaryExposureKeyReleaseParams;

interface INearbyExposureNotificationService{
void start(in StartParams params) = 0;
void stop(in StopParams params) = 1;
void isEnabled(in IsEnabledParams params) = 2;
void getTemporaryExposureKeyHistory(in GetTemporaryExposureKeyHistoryParams params) = 3;
void provideDiagnosisKeys(in ProvideDiagnosisKeysParams params) = 4;

void getExposureSummary(in GetExposureSummaryParams params) = 6;
void getExposureInformation(in GetExposureInformationParams params) = 7;

void getExposureWindows(in GetExposureWindowsParams params) = 12;
void getVersion(in GetVersionParams params) = 13;
void getCalibrationConfidence(in GetCalibrationConfidenceParams params) = 14;
void getDailySummaries(in GetDailySummariesParams params) = 15;
void setDiagnosisKeysDataMapping(in SetDiagnosisKeysDataMappingParams params) = 16;
void getDiagnosisKeysDataMapping(in GetDiagnosisKeysDataMappingParams params) = 17;
void getStatus(in GetStatusParams params) = 18;
void getPackageConfiguration(in GetPackageConfigurationParams params) = 19;
void requestPreAuthorizedTemporaryExposureKeyHistory(in RequestPreAuthorizedTemporaryExposureKeyHistoryParams params) = 20;
void requestPreAuthorizedTemporaryExposureKeyRelease(in RequestPreAuthorizedTemporaryExposureKeyReleaseParams params) = 21;
oneway void start(in StartParams params) = 0;
oneway void stop(in StopParams params) = 1;
oneway void isEnabled(in IsEnabledParams params) = 2;
oneway void getTemporaryExposureKeyHistory(in GetTemporaryExposureKeyHistoryParams params) = 3;
oneway void provideDiagnosisKeys(in ProvideDiagnosisKeysParams params) = 4;
//oneway void getMaxDiagnosisKeyCount(in GetMaxDiagnosisKeyCountParams params) = 5;
oneway void getExposureSummary(in GetExposureSummaryParams params) = 6;
oneway void getExposureInformation(in GetExposureInformationParams params) = 7;
//oneway void resetAllData(in ResetAllDataParams params) = 8;
//oneway void resetTemporaryExposureKeys(in ResetTemporaryExposureKeysParams params) = 9;
//oneway void startForPackage(in StartForPackageParams params) = 10;
//oneway void isEnabledForPackage(in IsEnabledForPackageParams params) = 11;
oneway void getExposureWindows(in GetExposureWindowsParams params) = 12;
oneway void getVersion(in GetVersionParams params) = 13;
oneway void getCalibrationConfidence(in GetCalibrationConfidenceParams params) = 14;
oneway void getDailySummaries(in GetDailySummariesParams params) = 15;
oneway void setDiagnosisKeysDataMapping(in SetDiagnosisKeysDataMappingParams params) = 16;
oneway void getDiagnosisKeysDataMapping(in GetDiagnosisKeysDataMappingParams params) = 17;
oneway void getStatus(in GetStatusParams params) = 18;
oneway void getPackageConfiguration(in GetPackageConfigurationParams params) = 19;
oneway void requestPreAuthorizedTemporaryExposureKeyHistory(in RequestPreAuthorizedTemporaryExposureKeyHistoryParams params) = 20;
oneway void requestPreAuthorizedTemporaryExposureKeyRelease(in RequestPreAuthorizedTemporaryExposureKeyReleaseParams params) = 21;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import org.microg.gms.common.PackageUtils
import org.microg.gms.nearby.exposurenotification.Constants.*
import org.microg.gms.nearby.exposurenotification.proto.TemporaryExposureKeyExport
import org.microg.gms.nearby.exposurenotification.proto.TemporaryExposureKeyProto
import org.microg.gms.utils.warnOnTransactionIssues
import java.io.File
import java.io.InputStream
import java.security.MessageDigest
Expand Down Expand Up @@ -670,11 +671,7 @@ class ExposureNotificationServiceImpl(private val context: Context, private val
}
}

override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean {
if (super.onTransact(code, data, reply, flags)) return true
Log.d(TAG, "onTransact [unknown]: $code, $data, $flags")
return false
}
override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean = warnOnTransactionIssues(TAG, code, reply, flags) { super.onTransact(code, data, reply, flags) }

companion object {
private val tempGrantedPermissions: MutableSet<Pair<String, String>> = hashSetOf()
Expand Down

0 comments on commit 2e286a7

Please sign in to comment.