Revert "Only allow the system server to connect to sync adapters"

This reverts commit 4df2de8380.

There was a bug in the CL. Rather than fixing it forward, let's revert
it and fix it in a follow-up CL, so we'll only have to back-port
a single CL.

Bug: 203229608
Test: N/A, a follow-up CL will redo this change with a Test: line.

Change-Id: I5fddf283ace09996a2e5cfc272f8e9fd8168a114
This commit is contained in:
Makoto Onuki
2022-04-19 10:53:34 -07:00
parent d248c68122
commit eef327f536

View File

@@ -21,7 +21,6 @@ import static com.android.internal.util.function.pooled.PooledLambda.obtainMessa
import android.accounts.Account;
import android.annotation.MainThread;
import android.annotation.NonNull;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
@@ -172,17 +171,8 @@ public abstract class AbstractThreadedSyncAdapter {
}
private class ISyncAdapterImpl extends ISyncAdapter.Stub {
private void enforceCallerSystem() {
final long callingUid = Binder.getCallingUid();
if (callingUid != Process.SYSTEM_UID) {
android.util.EventLog.writeEvent(0x534e4554, "203229608", -1, "");
return;
}
}
@Override
public void onUnsyncableAccount(ISyncAdapterUnsyncableAccountCallback cb) {
enforceCallerSystem();
Handler.getMain().sendMessage(obtainMessage(
AbstractThreadedSyncAdapter::handleOnUnsyncableAccount,
AbstractThreadedSyncAdapter.this, cb));
@@ -197,8 +187,6 @@ public abstract class AbstractThreadedSyncAdapter {
}
Log.d(TAG, "startSync() start " + authority + " " + account + " " + extras);
}
enforceCallerSystem();
try {
final SyncContext syncContextClient = new SyncContext(syncContext);
@@ -254,7 +242,6 @@ public abstract class AbstractThreadedSyncAdapter {
@Override
public void cancelSync(ISyncContext syncContext) {
enforceCallerSystem();
try {
// synchronize to make sure that mSyncThreads doesn't change between when we
// check it and when we use it