Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4b8bb98d authored by Matthew Williams's avatar Matthew Williams Committed by Android (Google) Code Review
Browse files

Merge "Redact SyncService stuff from master"

parents c442d5d9 5a9decd5
Loading
Loading
Loading
Loading
+0 −18
Original line number Diff line number Diff line
@@ -6752,7 +6752,6 @@ package android.content {
    method public final android.os.Bundle call(android.net.Uri, java.lang.String, java.lang.String, android.os.Bundle);
    method public deprecated void cancelSync(android.net.Uri);
    method public static void cancelSync(android.accounts.Account, java.lang.String);
    method public static void cancelSync(android.content.ComponentName);
    method public static void cancelSync(android.content.SyncRequest);
    method public final android.net.Uri canonicalize(android.net.Uri);
    method public final int delete(android.net.Uri, java.lang.String, java.lang.String[]);
@@ -6762,18 +6761,14 @@ package android.content {
    method public static boolean getMasterSyncAutomatically();
    method public java.util.List<android.content.UriPermission> getOutgoingPersistedUriPermissions();
    method public static java.util.List<android.content.PeriodicSync> getPeriodicSyncs(android.accounts.Account, java.lang.String);
    method public static java.util.List<android.content.PeriodicSync> getPeriodicSyncs(android.content.ComponentName);
    method public java.util.List<android.content.UriPermission> getPersistedUriPermissions();
    method public java.lang.String[] getStreamTypes(android.net.Uri, java.lang.String);
    method public static android.content.SyncAdapterType[] getSyncAdapterTypes();
    method public static boolean getSyncAutomatically(android.accounts.Account, java.lang.String);
    method public final java.lang.String getType(android.net.Uri);
    method public final android.net.Uri insert(android.net.Uri, android.content.ContentValues);
    method public static boolean isServiceActive(android.content.ComponentName);
    method public static boolean isSyncActive(android.accounts.Account, java.lang.String);
    method public static boolean isSyncActive(android.content.ComponentName);
    method public static boolean isSyncPending(android.accounts.Account, java.lang.String);
    method public static boolean isSyncPending(android.content.ComponentName);
    method public void notifyChange(android.net.Uri, android.database.ContentObserver);
    method public void notifyChange(android.net.Uri, android.database.ContentObserver, boolean);
    method public final android.content.res.AssetFileDescriptor openAssetFileDescriptor(android.net.Uri, java.lang.String) throws java.io.FileNotFoundException;
@@ -6795,7 +6790,6 @@ package android.content {
    method public static void requestSync(android.content.SyncRequest);
    method public static void setIsSyncable(android.accounts.Account, java.lang.String, int);
    method public static void setMasterSyncAutomatically(boolean);
    method public static void setServiceActive(android.content.ComponentName, boolean);
    method public static void setSyncAutomatically(android.accounts.Account, java.lang.String, boolean);
    method public deprecated void startSync(android.net.Uri, android.os.Bundle);
    method public void takePersistableUriPermission(android.net.Uri, int);
@@ -7763,9 +7757,7 @@ package android.content {
    field public final android.accounts.Account account;
    field public final java.lang.String authority;
    field public final android.os.Bundle extras;
    field public final boolean isService;
    field public final long period;
    field public final android.content.ComponentName service;
  }
  public class ReceiverCallNotAllowedException extends android.util.AndroidRuntimeException {
@@ -7881,7 +7873,6 @@ package android.content {
    method public void writeToParcel(android.os.Parcel, int);
    field public final android.accounts.Account account;
    field public final java.lang.String authority;
    field public final android.content.ComponentName service;
    field public final long startTime;
  }
@@ -7904,8 +7895,6 @@ package android.content {
    method public android.content.SyncRequest.Builder setNoRetry(boolean);
    method public android.content.SyncRequest.Builder setPriority(int);
    method public android.content.SyncRequest.Builder setSyncAdapter(android.accounts.Account, java.lang.String);
    method public android.content.SyncRequest.Builder setSyncAdapter(android.content.ComponentName);
    method public android.content.SyncRequest.Builder setTransferSize(long, long);
    method public android.content.SyncRequest.Builder syncOnce();
    method public android.content.SyncRequest.Builder syncPeriodic(long, long);
  }
@@ -7933,13 +7922,6 @@ package android.content {
    field public boolean tooManyRetries;
  }
  public abstract class SyncService extends android.app.Service {
    ctor public SyncService();
    method public android.os.IBinder onBind(android.content.Intent);
    method public abstract void onPerformSync(android.os.Bundle, android.content.SyncResult);
    method protected boolean parallelSyncsEnabled();
  }
  public class SyncStats implements android.os.Parcelable {
    ctor public SyncStats();
    ctor public SyncStats(android.os.Parcel);
+6 −86
Original line number Diff line number Diff line
@@ -1838,19 +1838,6 @@ public abstract class ContentResolver {
        }
    }

    /**
     * Cancel any active or pending syncs that are running on this service.
     *
     * @param cname the service for which to cancel all active/pending operations.
     */
    public static void cancelSync(ComponentName cname) {
        try {
            getContentService().cancelSync(null, null, cname);
        } catch (RemoteException e) {
            
        }
    }

    /**
     * Get information about the SyncAdapters that are known to the system.
     * @return an array of SyncAdapters that have registered with the system
@@ -1991,13 +1978,13 @@ public abstract class ContentResolver {
    /**
     * Remove the specified sync. This will cancel any pending or active syncs. If the request is
     * for a periodic sync, this call will remove any future occurrences.
     * <p>If a periodic sync is specified, the caller must hold the permission
     * {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}. If this SyncRequest targets a
     * SyncService adapter,the calling application must be signed with the same certificate as the
     * adapter.
     *</p>It is possible to cancel a sync using a SyncRequest object that is not the same object
     * <p>
     *     If a periodic sync is specified, the caller must hold the permission
     *     {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
     *</p>
     * It is possible to cancel a sync using a SyncRequest object that is not the same object
     * with which you requested the sync. Do so by building a SyncRequest with the same
     * service/adapter, frequency, <b>and</b> extras bundle.
     * adapter, frequency, <b>and</b> extras bundle.
     *
     * @param request SyncRequest object containing information about sync to cancel.
     */
@@ -2030,22 +2017,6 @@ public abstract class ContentResolver {
        }
    }

    /**
     * Return periodic syncs associated with the provided component.
     * <p>The calling application must be signed with the same certificate as the target component,
     * otherwise this call will fail.
     */
    public static List<PeriodicSync> getPeriodicSyncs(ComponentName cname) {
        if (cname == null) {
            throw new IllegalArgumentException("Component must not be null");
        }
        try {
            return getContentService().getPeriodicSyncs(null, null, cname);
        } catch (RemoteException e) {
            throw new RuntimeException("the ContentService should always be reachable", e);
        }
    }

    /**
     * Check if this account/provider is syncable.
     * <p>This method requires the caller to hold the permission
@@ -2075,38 +2046,6 @@ public abstract class ContentResolver {
        }
    }

    /**
     * Set whether the provided {@link SyncService} is available to process work.
     * <p>This method requires the caller to hold the permission
     * {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
     * <p>The calling application must be signed with the same certificate as the target component,
     * otherwise this call will fail.
     */
    public static void setServiceActive(ComponentName cname, boolean active) {
        try {
            getContentService().setServiceActive(cname, active);
        } catch (RemoteException e) {
            // exception ignored; if this is thrown then it means the runtime is in the midst of
            // being restarted
        }
    }

    /**
     * Query the state of this sync service.
     * <p>Set with {@link #setServiceActive(ComponentName cname, boolean active)}.
     * <p>The calling application must be signed with the same certificate as the target component,
     * otherwise this call will fail.
     * @param cname ComponentName referring to a {@link SyncService}
     * @return true if jobs will be run on this service, false otherwise.
     */
    public static boolean isServiceActive(ComponentName cname) {
        try {
            return getContentService().isServiceActive(cname);
        } catch (RemoteException e) {
            throw new RuntimeException("the ContentService should always be reachable", e);
        }
    }

    /**
     * Gets the master auto-sync setting that applies to all the providers and accounts.
     * If this is false then the per-provider auto-sync setting is ignored.
@@ -2164,17 +2103,6 @@ public abstract class ContentResolver {
        }
    }

    public static boolean isSyncActive(ComponentName cname) {
        if (cname == null) {
            throw new IllegalArgumentException("component name must not be null");
        }
        try {
            return getContentService().isSyncActive(null, null, cname);
        } catch (RemoteException e) {
            throw new RuntimeException("the ContentService should always be reachable", e);
        }
    }

    /**
     * If a sync is active returns the information about it, otherwise returns null.
     * <p>
@@ -2249,14 +2177,6 @@ public abstract class ContentResolver {
        }
    }

    public static boolean isSyncPending(ComponentName cname) {
        try {
            return getContentService().isSyncPending(null, null, cname);
        } catch (RemoteException e) {
            throw new RuntimeException("the ContentService should always be reachable", e);
        }
    }

    /**
     * Request notifications when the different aspects of the SyncManager change. The
     * different items that can be requested are:
+0 −13
Original line number Diff line number Diff line
@@ -121,19 +121,6 @@ interface IContentService {
     */
    void setIsSyncable(in Account account, String providerName, int syncable);

    /**
     * Corresponds roughly to setIsSyncable(String account, String provider) for syncs that bind
     * to a SyncService.
     */
    void setServiceActive(in ComponentName cname, boolean active);

    /**
     * Corresponds roughly to getIsSyncable(String account, String provider) for syncs that bind
     * to a SyncService.
     * @return 0 if this SyncService is not enabled, 1 if enabled, <0 if unknown.
     */
    boolean isServiceActive(in ComponentName cname);

    void setMasterSyncAutomatically(boolean flag);

    boolean getMasterSyncAutomatically();
+10 −63
Original line number Diff line number Diff line
@@ -29,14 +29,10 @@ public class PeriodicSync implements Parcelable {
    public final Account account;
    /** The authority of the sync. Can be null. */
    public final String authority;
    /** The service for syncing, if this is an anonymous sync. Can be null.*/
    public final ComponentName service;
    /** Any extras that parameters that are to be passed to the sync adapter. */
    public final Bundle extras;
    /** How frequently the sync should be scheduled, in seconds. Kept around for API purposes. */
    public final long period;
    /** Whether this periodic sync runs on a {@link SyncService}. */
    public final boolean isService;
    /**
     * How much flexibility can be taken in scheduling the sync, in seconds.
     * {@hide}
@@ -44,16 +40,11 @@ public class PeriodicSync implements Parcelable {
    public final long flexTime;

      /**
       * Creates a new PeriodicSync, copying the Bundle. SM no longer uses this ctor - kept around
       * becuse it is part of the API.
       * Note - even calls to the old API will not use this ctor, as
       * they are given a default flex time.
       * Creates a new PeriodicSync, copying the Bundle. This constructor is no longer used.
       */
    public PeriodicSync(Account account, String authority, Bundle extras, long periodInSeconds) {
        this.account = account;
        this.authority = authority;
        this.service = null;
        this.isService = false;
        if (extras == null) {
            this.extras = new Bundle();
        } else {
@@ -71,8 +62,6 @@ public class PeriodicSync implements Parcelable {
    public PeriodicSync(PeriodicSync other) {
        this.account = other.account;
        this.authority = other.authority;
        this.service = other.service;
        this.isService = other.isService;
        this.extras = new Bundle(other.extras);
        this.period = other.period;
        this.flexTime = other.flexTime;
@@ -86,40 +75,14 @@ public class PeriodicSync implements Parcelable {
            long period, long flexTime) {
        this.account = account;
        this.authority = authority;
        this.service = null;
        this.isService = false;
        this.extras = new Bundle(extras);
        this.period = period;
        this.flexTime = flexTime;
    }

    /**
     * A PeriodicSync for a sync with a specified SyncService.
     * {@hide}
     */
    public PeriodicSync(ComponentName service, Bundle extras,
            long period,
            long flexTime) {
        this.account = null;
        this.authority = null;
        this.service = service;
        this.isService = true;
        this.extras = new Bundle(extras);
        this.period = period;
        this.flexTime = flexTime;
    }

    private PeriodicSync(Parcel in) {
        this.isService = (in.readInt() != 0);
        if (this.isService) {
            this.service = in.readParcelable(null);
            this.account = null;
            this.authority = null;
        } else {
        this.account = in.readParcelable(null);
        this.authority = in.readString();
            this.service = null;
        }
        this.extras = in.readBundle();
        this.period = in.readLong();
        this.flexTime = in.readLong();
@@ -132,13 +95,8 @@ public class PeriodicSync implements Parcelable {

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(isService ? 1 : 0);
        if (account == null && authority == null) {
            dest.writeParcelable(service, flags);
        } else {
        dest.writeParcelable(account, flags);
        dest.writeString(authority);
        }
        dest.writeBundle(extras);
        dest.writeLong(period);
        dest.writeLong(flexTime);
@@ -165,24 +123,14 @@ public class PeriodicSync implements Parcelable {
            return false;
        }
        final PeriodicSync other = (PeriodicSync) o;
        if (this.isService != other.isService) {
            return false;
        }
        boolean equal = false;
        if (this.isService) {
            equal = service.equals(other.service);
        } else {
            equal = account.equals(other.account)
                    && authority.equals(other.authority);
        }
        return equal
        return account.equals(other.account)
                && authority.equals(other.authority)
                && period == other.period
                && syncExtrasEquals(extras, other.extras);
    }

    /**
     * Periodic sync extra comparison function. Duplicated from
     * {@link com.android.server.content.SyncManager#syncExtrasEquals(Bundle b1, Bundle b2)}
     * Periodic sync extra comparison function.
     * {@hide}
     */
    public static boolean syncExtrasEquals(Bundle b1, Bundle b2) {
@@ -207,7 +155,6 @@ public class PeriodicSync implements Parcelable {
    public String toString() {
        return "account: " + account +
               ", authority: " + authority +
               ", service: " + service +
               ". period: " + period + "s " +
               ", flex: " + flexTime;
    }
+3 −17
Original line number Diff line number Diff line
@@ -28,23 +28,15 @@ public class SyncInfo implements Parcelable {
    public final int authorityId;

    /**
     * The {@link Account} that is currently being synced. Will be null if this sync is running via
     * a {@link SyncService}.
     * The {@link Account} that is currently being synced.
     */
    public final Account account;

    /**
     * The authority of the provider that is currently being synced. Will be null if this sync
     * is running via a {@link SyncService}.
     * The authority of the provider that is currently being synced.
     */
    public final String authority;

    /**
     * The {@link SyncService} that is targeted by this operation. Null if this sync is running via
     * a {@link AbstractThreadedSyncAdapter}. 
     */
    public final ComponentName service;

    /**
     * The start time of the current sync operation in milliseconds since boot.
     * This is represented in elapsed real time.
@@ -53,13 +45,11 @@ public class SyncInfo implements Parcelable {
    public final long startTime;

    /** @hide */
    public SyncInfo(int authorityId, Account account, String authority, ComponentName service,
            long startTime) {
    public SyncInfo(int authorityId, Account account, String authority, long startTime) {
        this.authorityId = authorityId;
        this.account = account;
        this.authority = authority;
        this.startTime = startTime;
        this.service = service;
    }

    /** @hide */
@@ -68,7 +58,6 @@ public class SyncInfo implements Parcelable {
        this.account = new Account(other.account.name, other.account.type);
        this.authority = other.authority;
        this.startTime = other.startTime;
        this.service = other.service;
    }

    /** @hide */
@@ -82,8 +71,6 @@ public class SyncInfo implements Parcelable {
        parcel.writeParcelable(account, flags);
        parcel.writeString(authority);
        parcel.writeLong(startTime);
        parcel.writeParcelable(service, flags);
        
    }

    /** @hide */
@@ -92,7 +79,6 @@ public class SyncInfo implements Parcelable {
        account = parcel.readParcelable(Account.class.getClassLoader());
        authority = parcel.readString();
        startTime = parcel.readLong();
        service = parcel.readParcelable(ComponentName.class.getClassLoader());
    }

    /** @hide */
Loading