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

Commit 7b0301f8 authored by William Clark's avatar William Clark Committed by Linux Build Service Account
Browse files

SEEMP: Add more framework instrumentation

Instrument framework files to log events of interest.

Conflicts:
	core/java/android/accounts/AccountManager.java

Change-Id: Ia45651e6352586f910039b51cac2356f65f80010
parent 3dc18506
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -329,6 +329,7 @@ public class AccountManager {
     * @return The account's password, null if none or if the account doesn't exist
     */
    public String getPassword(final Account account) {
        android.util.SeempLog.record(25);
        if (account == null) throw new IllegalArgumentException("account is null");
        try {
            return mService.getPassword(account);
@@ -357,6 +358,7 @@ public class AccountManager {
     * @return The user data, null if the account or key doesn't exist
     */
    public String getUserData(final Account account, final String key) {
        android.util.SeempLog.record(26);
        if (account == null) throw new IllegalArgumentException("account is null");
        if (key == null) throw new IllegalArgumentException("key is null");
        try {
@@ -567,6 +569,7 @@ public class AccountManager {
        if (authTokenType == null) throw new IllegalArgumentException("authTokenType is null");
        return new Future2Task<String>(handler, callback) {
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(34);
                mService.getAuthTokenLabel(mResponse, accountType, authTokenType);
            }

@@ -612,6 +615,7 @@ public class AccountManager {
        if (features == null) throw new IllegalArgumentException("features is null");
        return new Future2Task<Boolean>(handler, callback) {
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(34);
                mService.hasFeatures(mResponse, account, features, mContext.getOpPackageName());
            }
            public Boolean bundleToResult(Bundle bundle) throws AuthenticatorException {
@@ -664,6 +668,7 @@ public class AccountManager {
        if (type == null) throw new IllegalArgumentException("type is null");
        return new Future2Task<Account[]>(handler, callback) {
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(34);
                mService.getAccountsByFeatures(mResponse, type, features,
                        mContext.getOpPackageName());
            }
@@ -707,6 +712,7 @@ public class AccountManager {
     *         already exists, the account is null, or another error occurs.
     */
    public boolean addAccountExplicitly(Account account, String password, Bundle userdata) {
        android.util.SeempLog.record(27);
        if (account == null) throw new IllegalArgumentException("account is null");
        try {
            return mService.addAccountExplicitly(account, password, userdata);
@@ -777,6 +783,7 @@ public class AccountManager {
        return new Future2Task<Account>(handler, callback) {
            @Override
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(34);
                mService.renameAccount(mResponse, account, newName);
            }
            @Override
@@ -837,10 +844,12 @@ public class AccountManager {
    @Deprecated
    public AccountManagerFuture<Boolean> removeAccount(final Account account,
            AccountManagerCallback<Boolean> callback, Handler handler) {
        android.util.SeempLog.record(28);
        if (account == null) throw new IllegalArgumentException("account is null");
        return new Future2Task<Boolean>(handler, callback) {
            @Override
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(34);
                mService.removeAccount(mResponse, account, false);
            }
            @Override
@@ -896,10 +905,12 @@ public class AccountManager {
     */
    public AccountManagerFuture<Bundle> removeAccount(final Account account,
            final Activity activity, AccountManagerCallback<Bundle> callback, Handler handler) {
        android.util.SeempLog.record(28);
        if (account == null) throw new IllegalArgumentException("account is null");
        return new AmsTask(activity, handler, callback) {
            @Override
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(34);
                mService.removeAccount(mResponse, account, activity != null);
            }
        }.start();
@@ -921,6 +932,7 @@ public class AccountManager {
        return new Future2Task<Boolean>(handler, callback) {
            @Override
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(34);
                mService.removeAccountAsUser(mResponse, account, false, userHandle.getIdentifier());
            }
            @Override
@@ -946,6 +958,7 @@ public class AccountManager {
            throw new IllegalArgumentException("userHandle is null");
        return new AmsTask(activity, handler, callback) {
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(34);
                mService.removeAccountAsUser(mResponse, account, activity != null,
                        userHandle.getIdentifier());
            }
@@ -998,6 +1011,7 @@ public class AccountManager {
     * @param authToken The auth token to invalidate, may be null
     */
    public void invalidateAuthToken(final String accountType, final String authToken) {
        android.util.SeempLog.record(117);
        if (accountType == null) throw new IllegalArgumentException("accountType is null");
        try {
            if (authToken != null) {
@@ -1031,6 +1045,7 @@ public class AccountManager {
     * @see #getAuthToken
     */
    public String peekAuthToken(final Account account, final String authTokenType) {
        android.util.SeempLog.record(121);
        if (account == null) throw new IllegalArgumentException("account is null");
        if (authTokenType == null) throw new IllegalArgumentException("authTokenType is null");
        try {
@@ -1062,6 +1077,7 @@ public class AccountManager {
     * @param password The password to set, null to clear the password
     */
    public void setPassword(final Account account, final String password) {
        android.util.SeempLog.record(29);
        if (account == null) throw new IllegalArgumentException("account is null");
        try {
            mService.setPassword(account, password);
@@ -1091,6 +1107,7 @@ public class AccountManager {
     * @param account The account whose password to clear
     */
    public void clearPassword(final Account account) {
        android.util.SeempLog.record(30);
        if (account == null) throw new IllegalArgumentException("account is null");
        try {
            mService.clearPassword(account);
@@ -1119,6 +1136,7 @@ public class AccountManager {
     * @param value String value to set, {@code null} to clear this user data key
     */
    public void setUserData(final Account account, final String key, final String value) {
        android.util.SeempLog.record(31);
        if (account == null) throw new IllegalArgumentException("account is null");
        if (key == null) throw new IllegalArgumentException("key is null");
        try {
@@ -1149,6 +1167,7 @@ public class AccountManager {
     * @param authToken The auth token to add to the cache
     */
    public void setAuthToken(Account account, final String authTokenType, final String authToken) {
        android.util.SeempLog.record(122);
        if (account == null) throw new IllegalArgumentException("account is null");
        if (authTokenType == null) throw new IllegalArgumentException("authTokenType is null");
        try {
@@ -1270,6 +1289,7 @@ public class AccountManager {
        optionsIn.putString(KEY_ANDROID_PACKAGE_NAME, mContext.getPackageName());
        return new AmsTask(activity, handler, callback) {
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(34);
                mService.getAuthToken(mResponse, account, authTokenType,
                        false /* notifyOnAuthFailure */, true /* expectActivityLaunch */,
                        optionsIn);
@@ -1438,6 +1458,7 @@ public class AccountManager {
        optionsIn.putString(KEY_ANDROID_PACKAGE_NAME, mContext.getPackageName());
        return new AmsTask(null, handler, callback) {
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(34);
                mService.getAuthToken(mResponse, account, authTokenType,
                        notifyAuthFailure, false /* expectActivityLaunch */, optionsIn);
            }
@@ -1498,6 +1519,7 @@ public class AccountManager {
            final String authTokenType, final String[] requiredFeatures,
            final Bundle addAccountOptions,
            final Activity activity, AccountManagerCallback<Bundle> callback, Handler handler) {
        android.util.SeempLog.record(32);
        if (accountType == null) throw new IllegalArgumentException("accountType is null");
        final Bundle optionsIn = new Bundle();
        if (addAccountOptions != null) {
@@ -1507,6 +1529,7 @@ public class AccountManager {

        return new AmsTask(activity, handler, callback) {
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(34);
                mService.addAccount(mResponse, accountType, authTokenType,
                        requiredFeatures, activity != null, optionsIn);
            }
@@ -1531,6 +1554,7 @@ public class AccountManager {

        return new AmsTask(activity, handler, callback) {
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(34);
                mService.addAccountAsUser(mResponse, accountType, authTokenType,
                        requiredFeatures, activity != null, optionsIn, userHandle.getIdentifier());
            }
@@ -1578,6 +1602,7 @@ public class AccountManager {
        return new Future2Task<Boolean>(handler, callback) {
            @Override
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(34);
                mService.copyAccountToUser(
                        mResponse, account, UserHandle.USER_OWNER, user.getIdentifier());
            }
@@ -1687,6 +1712,7 @@ public class AccountManager {
            final Activity activity,
            final AccountManagerCallback<Bundle> callback,
            final Handler handler) {
        android.util.SeempLog.record(116);
        return confirmCredentialsAsUser(account, options, activity, callback, handler,
                Process.myUserHandle());
    }
@@ -1705,6 +1731,7 @@ public class AccountManager {
        final int userId = userHandle.getIdentifier();
        return new AmsTask(activity, handler, callback) {
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(34);
                mService.confirmCredentialsAsUser(mResponse, account, options, activity != null,
                        userId);
            }
@@ -1764,9 +1791,11 @@ public class AccountManager {
            final Bundle options, final Activity activity,
            final AccountManagerCallback<Bundle> callback,
            final Handler handler) {
        android.util.SeempLog.record(118);
        if (account == null) throw new IllegalArgumentException("account is null");
        return new AmsTask(activity, handler, callback) {
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(34);
                mService.updateCredentials(mResponse, account, authTokenType, activity != null,
                        options);
            }
@@ -1817,9 +1846,11 @@ public class AccountManager {
    public AccountManagerFuture<Bundle> editProperties(final String accountType,
            final Activity activity, final AccountManagerCallback<Bundle> callback,
            final Handler handler) {
        android.util.SeempLog.record(33);
        if (accountType == null) throw new IllegalArgumentException("accountType is null");
        return new AmsTask(activity, handler, callback) {
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(34);
                mService.editProperties(mResponse, accountType, activity != null);
            }
        }.start();
@@ -2175,6 +2206,7 @@ public class AccountManager {
        private volatile int mNumAccounts = 0;

        public void doWork() throws RemoteException {
            android.util.SeempLog.record(34);
            getAccountsByTypeAndFeatures(mAccountType, mFeatures,
                    new AccountManagerCallback<Account[]>() {
                        public void run(AccountManagerFuture<Account[]> future) {
+7 −0
Original line number Diff line number Diff line
@@ -374,6 +374,7 @@ public class Instrumentation {
     * @see Context#startActivity
     */
    public Activity startActivitySync(Intent intent) {
        android.util.SeempLog.record_str(406, intent.toString());
        validateNotAppThread();

        synchronized (mSync) {
@@ -1481,6 +1482,7 @@ public class Instrumentation {
    public ActivityResult execStartActivity(
            Context who, IBinder contextThread, IBinder token, Activity target,
            Intent intent, int requestCode, Bundle options) {
        android.util.SeempLog.record_str(407, intent.toString());
        IApplicationThread whoThread = (IApplicationThread) contextThread;
        Uri referrer = target != null ? target.onProvideReferrer() : null;
        if (referrer != null) {
@@ -1541,6 +1543,7 @@ public class Instrumentation {
    public void execStartActivitiesAsUser(Context who, IBinder contextThread,
            IBinder token, Activity target, Intent[] intents, Bundle options,
            int userId) {
        android.util.SeempLog.record_str(408, intents.toString());
        IApplicationThread whoThread = (IApplicationThread) contextThread;
        if (mActivityMonitors != null) {
            synchronized (mSync) {
@@ -1604,6 +1607,7 @@ public class Instrumentation {
    public ActivityResult execStartActivity(
        Context who, IBinder contextThread, IBinder token, String target,
        Intent intent, int requestCode, Bundle options) {
        android.util.SeempLog.record_str(407, intent.toString());
        IApplicationThread whoThread = (IApplicationThread) contextThread;
        if (mActivityMonitors != null) {
            synchronized (mSync) {
@@ -1664,6 +1668,7 @@ public class Instrumentation {
    public ActivityResult execStartActivity(
            Context who, IBinder contextThread, IBinder token, Activity target,
            Intent intent, int requestCode, Bundle options, UserHandle user) {
        android.util.SeempLog.record_str(407, intent.toString());
        IApplicationThread whoThread = (IApplicationThread) contextThread;
        if (mActivityMonitors != null) {
            synchronized (mSync) {
@@ -1703,6 +1708,7 @@ public class Instrumentation {
            Context who, IBinder contextThread, IBinder token, Activity target,
            Intent intent, int requestCode, Bundle options, boolean ignoreTargetSecurity,
            int userId) {
        android.util.SeempLog.record_str(409, intent.toString());
        IApplicationThread whoThread = (IApplicationThread) contextThread;
        if (mActivityMonitors != null) {
            synchronized (mSync) {
@@ -1741,6 +1747,7 @@ public class Instrumentation {
    public void execStartActivityFromAppTask(
            Context who, IBinder contextThread, IAppTask appTask,
            Intent intent, Bundle options) {
        android.util.SeempLog.record_str(410, intent.toString());
        IApplicationThread whoThread = (IApplicationThread) contextThread;
        if (mActivityMonitors != null) {
            synchronized (mSync) {
+10 −0
Original line number Diff line number Diff line
@@ -538,6 +538,7 @@ public final class BluetoothAdapter {
     * @throws IllegalArgumentException if address is invalid
     */
    public BluetoothDevice getRemoteDevice(String address) {
        android.util.SeempLog.record(79);
        return new BluetoothDevice(address);
    }

@@ -553,6 +554,7 @@ public final class BluetoothAdapter {
     * @throws IllegalArgumentException if address is invalid
     */
    public BluetoothDevice getRemoteDevice(byte[] address) {
        android.util.SeempLog.record(79);
        if (address == null || address.length != 6) {
            throw new IllegalArgumentException("Bluetooth address must have 6 bytes");
        }
@@ -784,6 +786,7 @@ public final class BluetoothAdapter {
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    @AdapterState
    public int getState() {
        android.util.SeempLog.record(80);
        try {
            synchronized(mManagerCallback) {
                if (mService != null)
@@ -880,6 +883,7 @@ public final class BluetoothAdapter {
     */
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    public boolean enable() {
        android.util.SeempLog.record(73);
        int state = STATE_OFF;
        if (isEnabled() == true){
            if (DBG) Log.d(TAG, "enable(): BT is already enabled..!");
@@ -929,6 +933,7 @@ public final class BluetoothAdapter {
     */
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    public boolean disable() {
        android.util.SeempLog.record(74);
        try {
            return mManagerService.disable(true);
        } catch (RemoteException e) {Log.e(TAG, "", e);}
@@ -946,6 +951,7 @@ public final class BluetoothAdapter {
     * @hide
     */
    public boolean disable(boolean persist) {
        android.util.SeempLog.record(74);

        try {
            return mManagerService.disable(persist);
@@ -1190,6 +1196,7 @@ public final class BluetoothAdapter {
     */
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    public boolean startDiscovery() {
        android.util.SeempLog.record(75);
        if (getState() != STATE_ON) return false;
        try {
            synchronized(mManagerCallback) {
@@ -1408,6 +1415,7 @@ public final class BluetoothAdapter {
     */
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    public Set<BluetoothDevice> getBondedDevices() {
        android.util.SeempLog.record(78);
        if (getState() != STATE_ON) {
            return toDeviceSet(new BluetoothDevice[0]);
        }
@@ -1460,6 +1468,7 @@ public final class BluetoothAdapter {
     */
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    public int getProfileConnectionState(int profile) {
        android.util.SeempLog.record(81);
        if (getState() != STATE_ON) return BluetoothProfile.STATE_DISCONNECTED;
        try {
            synchronized(mManagerCallback) {
@@ -1582,6 +1591,7 @@ public final class BluetoothAdapter {
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    public BluetoothServerSocket listenUsingInsecureRfcommWithServiceRecord(String name, UUID uuid)
            throws IOException {
        android.util.SeempLog.record(76);
        return createNewRfcommSocketAndRecord(name, uuid, false, false);
    }

+3 −0
Original line number Diff line number Diff line
@@ -431,6 +431,7 @@ public abstract class ContentResolver {
    public final @Nullable Cursor query(@NonNull Uri uri, @Nullable String[] projection,
            @Nullable String selection, @Nullable String[] selectionArgs,
            @Nullable String sortOrder) {
        android.util.SeempLog.record(16);
        return query(uri, projection, selection, selectionArgs, sortOrder, null);
    }

@@ -471,6 +472,7 @@ public abstract class ContentResolver {
    public final @Nullable Cursor query(final @NonNull Uri uri, @Nullable String[] projection,
            @Nullable String selection, @Nullable String[] selectionArgs,
            @Nullable String sortOrder, @Nullable CancellationSignal cancellationSignal) {
        android.util.SeempLog.record(16);
        Preconditions.checkNotNull(uri, "uri");
        IContentProvider unstableProvider = acquireUnstableProvider(uri);
        if (unstableProvider == null) {
@@ -1221,6 +1223,7 @@ public abstract class ContentResolver {
     * @return the URL of the newly created row.
     */
    public final @Nullable Uri insert(@NonNull Uri url, @Nullable ContentValues values) {
        android.util.SeempLog.record(50);
        Preconditions.checkNotNull(url, "url");
        IContentProvider provider = acquireProvider(url);
        if (provider == null) {
+5 −0
Original line number Diff line number Diff line
@@ -789,6 +789,7 @@ public class Camera {
     * @see android.media.MediaActionSound
     */
    public final void setPreviewCallback(PreviewCallback cb) {
        android.util.SeempLog.record(83);
        mPreviewCallback = cb;
        mOneShot = false;
        mWithBuffer = false;
@@ -815,6 +816,7 @@ public class Camera {
     * @see android.media.MediaActionSound
     */
    public final void setOneShotPreviewCallback(PreviewCallback cb) {
        android.util.SeempLog.record(85);
        mPreviewCallback = cb;
        mOneShot = true;
        mWithBuffer = false;
@@ -853,6 +855,7 @@ public class Camera {
     * @see android.media.MediaActionSound
     */
    public final void setPreviewCallbackWithBuffer(PreviewCallback cb) {
        android.util.SeempLog.record(84);
        mPreviewCallback = cb;
        mOneShot = false;
        mWithBuffer = true;
@@ -1415,6 +1418,7 @@ public class Camera {
     */
    public final void takePicture(ShutterCallback shutter, PictureCallback raw,
            PictureCallback jpeg) {
        android.util.SeempLog.record(82);
        takePicture(shutter, raw, null, jpeg);
    }
    private native final void native_takePicture(int msgType);
@@ -1450,6 +1454,7 @@ public class Camera {
     */
    public final void takePicture(ShutterCallback shutter, PictureCallback raw,
            PictureCallback postview, PictureCallback jpeg) {
        android.util.SeempLog.record(82);
        mShutterCallback = shutter;
        mRawImageCallback = raw;
        mPostviewCallback = postview;
Loading