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

Commit 01849519 authored by Fred Quintana's avatar Fred Quintana Committed by Android Git Automerger
Browse files

am 010fbfc9: am 344ba661: am d5e4fdc8: some changes due to an API review -...

am 010fbfc9: am 344ba661: am d5e4fdc8: some changes due to an API review  - make EntityIterator extend Iterator and thus not throw a    RemoteException, instead converting it into a RuntimeException.  - rename ActiveSyncInfo to SyncInfo  - change getActiveSync to getC
parents 70d6a628 010fbfc9
Loading
Loading
Loading
Loading
+43 −72
Original line number Diff line number Diff line
@@ -30012,48 +30012,6 @@
>
</field>
</class>
<class name="ActiveSyncInfo"
 extends="java.lang.Object"
 abstract="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<method name="getAccount"
 return="android.accounts.Account"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getAuthority"
 return="java.lang.String"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getStartTime"
 return="long"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
</class>
<class name="ActivityNotFoundException"
 extends="java.lang.RuntimeException"
 abstract="false"
@@ -32089,8 +32047,8 @@
<parameter name="selectionArgs" type="java.lang.String[]">
</parameter>
</method>
<method name="getActiveSync"
 return="android.content.ActiveSyncInfo"
<method name="getCurrentSync"
 return="android.content.SyncInfo"
 abstract="false"
 native="false"
 synchronized="false"
@@ -36131,6 +36089,8 @@
 deprecated="not deprecated"
 visibility="public"
>
<implements name="java.util.Iterator">
</implements>
<method name="close"
 return="void"
 abstract="true"
@@ -36142,32 +36102,6 @@
 visibility="public"
>
</method>
<method name="hasNext"
 return="boolean"
 abstract="true"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<exception name="RemoteException" type="android.os.RemoteException">
</exception>
</method>
<method name="next"
 return="android.content.Entity"
 abstract="true"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<exception name="RemoteException" type="android.os.RemoteException">
</exception>
</method>
<method name="reset"
 return="void"
 abstract="true"
@@ -36178,8 +36112,6 @@
 deprecated="not deprecated"
 visibility="public"
>
<exception name="RemoteException" type="android.os.RemoteException">
</exception>
</method>
</interface>
<class name="Intent"
@@ -41612,6 +41544,45 @@
</parameter>
</method>
</class>
<class name="SyncInfo"
 extends="java.lang.Object"
 abstract="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<field name="account"
 type="android.accounts.Account"
 transient="false"
 volatile="false"
 static="false"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="authority"
 type="java.lang.String"
 transient="false"
 volatile="false"
 static="false"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="startTime"
 type="long"
 transient="false"
 volatile="false"
 static="false"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
<class name="SyncResult"
 extends="java.lang.Object"
 abstract="false"
+14 −10
Original line number Diff line number Diff line
@@ -17,12 +17,10 @@
package android.content;

import android.accounts.Account;
import android.net.TrafficStats;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Process;
import android.os.RemoteException;
import android.util.EventLog;

import java.util.concurrent.atomic.AtomicInteger;

@@ -113,12 +111,13 @@ public abstract class AbstractThreadedSyncAdapter {
        public void cancelSync(ISyncContext syncContext) {
            // synchronize to make sure that mSyncThread doesn't change between when we
            // check it and when we use it
            final SyncThread syncThread;
            synchronized (mSyncThreadLock) {
                if (mSyncThread != null
                        && mSyncThread.mSyncContext.getSyncContextBinder()
                        == syncContext.asBinder()) {
                    onSyncCanceled(mSyncThread);
                syncThread = mSyncThread;
            }
            if (syncThread != null
                    && syncThread.mSyncContext.getSyncContextBinder() == syncContext.asBinder()) {
                onSyncCanceled();
            }
        }

@@ -213,9 +212,14 @@ public abstract class AbstractThreadedSyncAdapter {
     * thread than the sync thread and so you must consider the multi-threaded implications
     * of the work that you do in this method.
     *
     * @param thread the thread that is running the sync operation to cancel
     */
    public void onSyncCanceled(Thread thread) {
        thread.interrupt();
    public void onSyncCanceled() {
        final SyncThread syncThread;
        synchronized (mSyncThreadLock) {
            syncThread = mSyncThread;
        }
        if (syncThread != null) {
            syncThread.interrupt();
        }
    }
}
+3 −3
Original line number Diff line number Diff line
@@ -1179,11 +1179,11 @@ public abstract class ContentResolver {

    /**
     * If a sync is active returns the information about it, otherwise returns false.
     * @return the ActiveSyncInfo for the currently active sync or null if one is not active.
     * @return the SyncInfo for the currently active sync or null if one is not active.
     */
    public static ActiveSyncInfo getActiveSync() {
    public static SyncInfo getCurrentSync() {
        try {
            return getContentService().getActiveSync();
            return getContentService().getCurrentSync();
        } catch (RemoteException e) {
            throw new RuntimeException("the ContentService should always be reachable", e);
        }
+2 −2
Original line number Diff line number Diff line
@@ -386,14 +386,14 @@ public final class ContentService extends IContentService.Stub {
        return false;
    }

    public ActiveSyncInfo getActiveSync() {
    public SyncInfo getCurrentSync() {
        mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_STATS,
                "no permission to read the sync stats");
        long identityToken = clearCallingIdentity();
        try {
            SyncManager syncManager = getSyncManager();
            if (syncManager != null) {
                return syncManager.getSyncStorageEngine().getActiveSync();
                return syncManager.getSyncStorageEngine().getCurrentSync();
            }
        } finally {
            restoreCallingIdentity(identityToken);
+14 −6
Original line number Diff line number Diff line
@@ -53,9 +53,9 @@ public abstract class CursorEntityIterator implements EntityIterator {
     * iterator is positioned in front of an element.
     *
     * @return {@code true} if there are more elements, {@code false} otherwise.
     * @see #next
     * @see EntityIterator#next()
     */
    public final boolean hasNext() throws RemoteException {
    public final boolean hasNext() {
        if (mIsClosed) {
            throw new IllegalStateException("calling hasNext() when the iterator is closed");
        }
@@ -70,9 +70,9 @@ public abstract class CursorEntityIterator implements EntityIterator {
     * @return the next object.
     * @throws java.util.NoSuchElementException
     *             if there are no more elements.
     * @see #hasNext
     * @see EntityIterator#hasNext()
     */
    public Entity next() throws RemoteException {
    public Entity next() {
        if (mIsClosed) {
            throw new IllegalStateException("calling next() when the iterator is closed");
        }
@@ -80,10 +80,18 @@ public abstract class CursorEntityIterator implements EntityIterator {
            throw new IllegalStateException("you may only call next() if hasNext() is true");
        }

        try {
            return getEntityAndIncrementCursor(mCursor);
        } catch (RemoteException e) {
            throw new RuntimeException("caught a remote exception, this process will die soon", e);
        }
    }

    public void remove() {
        throw new UnsupportedOperationException("remove not supported by EntityIterators");
    }

    public final void reset() throws RemoteException {
    public final void reset() {
        if (mIsClosed) {
            throw new IllegalStateException("calling reset() when the iterator is closed");
        }
Loading