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

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

SEEMP: add framework instrumentation

- Instrument framework files to log events of interest for QSSP.

- Fix the String out of boundary

CRs-Fixed: 1020829

Change-Id: Iab970a78e48a504a9eff066cb3c0abe83a62513a
parent 91338fb3
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -349,6 +349,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(22);
        if (account == null) throw new IllegalArgumentException("account is null");
        try {
            return mService.getPassword(account);
@@ -376,6 +377,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(23);
        if (account == null) throw new IllegalArgumentException("account is null");
        if (key == null) throw new IllegalArgumentException("key is null");
        try {
@@ -584,6 +586,7 @@ public class AccountManager {
        return new Future2Task<String>(handler, callback) {
            @Override
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(31);
                mService.getAuthTokenLabel(mResponse, accountType, authTokenType);
            }

@@ -630,6 +633,7 @@ public class AccountManager {
        return new Future2Task<Boolean>(handler, callback) {
            @Override
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(31);
                mService.hasFeatures(mResponse, account, features, mContext.getOpPackageName());
            }
            @Override
@@ -684,6 +688,7 @@ public class AccountManager {
        return new Future2Task<Account[]>(handler, callback) {
            @Override
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(31);
                mService.getAccountsByFeatures(mResponse, type, features,
                        mContext.getOpPackageName());
            }
@@ -728,6 +733,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(24);
        if (account == null) throw new IllegalArgumentException("account is null");
        try {
            return mService.addAccountExplicitly(account, password, userdata);
@@ -797,6 +803,7 @@ public class AccountManager {
        return new Future2Task<Account>(handler, callback) {
            @Override
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(31);
                mService.renameAccount(mResponse, account, newName);
            }
            @Override
@@ -856,10 +863,12 @@ public class AccountManager {
    @Deprecated
    public AccountManagerFuture<Boolean> removeAccount(final Account account,
            AccountManagerCallback<Boolean> callback, Handler handler) {
        android.util.SeempLog.record(25);
        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(31);
                mService.removeAccount(mResponse, account, false);
            }
            @Override
@@ -915,10 +924,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();
@@ -940,6 +951,7 @@ public class AccountManager {
        return new Future2Task<Boolean>(handler, callback) {
            @Override
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(31);
                mService.removeAccountAsUser(mResponse, account, false, userHandle.getIdentifier());
            }
            @Override
@@ -966,6 +978,7 @@ public class AccountManager {
        return new AmsTask(activity, handler, callback) {
            @Override
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(34);
                mService.removeAccountAsUser(mResponse, account, activity != null,
                        userHandle.getIdentifier());
            }
@@ -1079,6 +1092,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(26);
        if (account == null) throw new IllegalArgumentException("account is null");
        try {
            mService.setPassword(account, password);
@@ -1107,6 +1121,7 @@ public class AccountManager {
     * @param account The account whose password to clear
     */
    public void clearPassword(final Account account) {
        android.util.SeempLog.record(27);
        if (account == null) throw new IllegalArgumentException("account is null");
        try {
            mService.clearPassword(account);
@@ -1134,6 +1149,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(28);
        if (account == null) throw new IllegalArgumentException("account is null");
        if (key == null) throw new IllegalArgumentException("key is null");
        try {
@@ -1284,6 +1300,7 @@ public class AccountManager {
        return new AmsTask(activity, handler, callback) {
            @Override
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(31);
                mService.getAuthToken(mResponse, account, authTokenType,
                        false /* notifyOnAuthFailure */, true /* expectActivityLaunch */,
                        optionsIn);
@@ -1453,6 +1470,7 @@ public class AccountManager {
        return new AmsTask(null, handler, callback) {
            @Override
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(31);
                mService.getAuthToken(mResponse, account, authTokenType,
                        notifyAuthFailure, false /* expectActivityLaunch */, optionsIn);
            }
@@ -1513,6 +1531,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(29);
        if (accountType == null) throw new IllegalArgumentException("accountType is null");
        final Bundle optionsIn = new Bundle();
        if (addAccountOptions != null) {
@@ -1523,6 +1542,7 @@ public class AccountManager {
        return new AmsTask(activity, handler, callback) {
            @Override
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(31);
                mService.addAccount(mResponse, accountType, authTokenType,
                        requiredFeatures, activity != null, optionsIn);
            }
@@ -1548,6 +1568,7 @@ public class AccountManager {
        return new AmsTask(activity, handler, callback) {
            @Override
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(31);
                mService.addAccountAsUser(mResponse, accountType, authTokenType,
                        requiredFeatures, activity != null, optionsIn, userHandle.getIdentifier());
            }
@@ -1597,6 +1618,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, fromUser.getIdentifier(), toUser.getIdentifier());
            }
@@ -1723,6 +1745,7 @@ public class AccountManager {
        return new AmsTask(activity, handler, callback) {
            @Override
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(31);
                mService.confirmCredentialsAsUser(mResponse, account, options, activity != null,
                        userId);
            }
@@ -1836,10 +1859,12 @@ public class AccountManager {
    public AccountManagerFuture<Bundle> editProperties(final String accountType,
            final Activity activity, final AccountManagerCallback<Bundle> callback,
            final Handler handler) {
        android.util.SeempLog.record(30);
        if (accountType == null) throw new IllegalArgumentException("accountType is null");
        return new AmsTask(activity, handler, callback) {
            @Override
            public void doWork() throws RemoteException {
                android.util.SeempLog.record(31);
                mService.editProperties(mResponse, accountType, activity != null);
            }
        }.start();
@@ -2227,6 +2252,7 @@ public class AccountManager {

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

        synchronized (mSync) {
@@ -1492,6 +1493,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(377, intent.toString());
        IApplicationThread whoThread = (IApplicationThread) contextThread;
        Uri referrer = target != null ? target.onProvideReferrer() : null;
        if (referrer != null) {
@@ -1552,6 +1554,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(378, intents.toString());
        IApplicationThread whoThread = (IApplicationThread) contextThread;
        if (mActivityMonitors != null) {
            synchronized (mSync) {
@@ -1615,6 +1618,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(377, intent.toString());
        IApplicationThread whoThread = (IApplicationThread) contextThread;
        if (mActivityMonitors != null) {
            synchronized (mSync) {
@@ -1675,6 +1679,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(377, intent.toString());
        IApplicationThread whoThread = (IApplicationThread) contextThread;
        if (mActivityMonitors != null) {
            synchronized (mSync) {
@@ -1714,6 +1719,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(379, intent.toString());
        IApplicationThread whoThread = (IApplicationThread) contextThread;
        if (mActivityMonitors != null) {
            synchronized (mSync) {
@@ -1752,6 +1758,7 @@ public class Instrumentation {
    public void execStartActivityFromAppTask(
            Context who, IBinder contextThread, IAppTask appTask,
            Intent intent, Bundle options) {
        android.util.SeempLog.record_str(380, intent.toString());
        IApplicationThread whoThread = (IApplicationThread) contextThread;
        if (mActivityMonitors != null) {
            synchronized (mSync) {
+10 −0
Original line number Diff line number Diff line
@@ -545,6 +545,7 @@ public final class BluetoothAdapter {
     * @throws IllegalArgumentException if address is invalid
     */
    public BluetoothDevice getRemoteDevice(String address) {
        android.util.SeempLog.record(62);
        return new BluetoothDevice(address);
    }

@@ -560,6 +561,7 @@ public final class BluetoothAdapter {
     * @throws IllegalArgumentException if address is invalid
     */
    public BluetoothDevice getRemoteDevice(byte[] address) {
        android.util.SeempLog.record(62);
        if (address == null || address.length != 6) {
            throw new IllegalArgumentException("Bluetooth address must have 6 bytes");
        }
@@ -799,6 +801,7 @@ public final class BluetoothAdapter {
    public int getState() {
        int state = BluetoothAdapter.STATE_OFF;

        android.util.SeempLog.record(63);
        try {
            mServiceLock.readLock().lock();
            if (mService != null) {
@@ -897,6 +900,7 @@ public final class BluetoothAdapter {
     */
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    public boolean enable() {
        android.util.SeempLog.record(56);
        if (isEnabled() == true) {
            if (DBG) Log.d(TAG, "enable(): BT is already enabled..!");
            return true;
@@ -933,6 +937,7 @@ public final class BluetoothAdapter {
     */
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    public boolean disable() {
        android.util.SeempLog.record(57);
        try {
            return mManagerService.disable(true);
        } catch (RemoteException e) {Log.e(TAG, "", e);}
@@ -950,6 +955,7 @@ public final class BluetoothAdapter {
     * @hide
     */
    public boolean disable(boolean persist) {
        android.util.SeempLog.record(57);

        try {
            return mManagerService.disable(persist);
@@ -1221,6 +1227,7 @@ public final class BluetoothAdapter {
     */
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    public boolean startDiscovery() {
        android.util.SeempLog.record(58);
        if (getState() != STATE_ON) return false;
        try {
            mServiceLock.readLock().lock();
@@ -1479,6 +1486,7 @@ public final class BluetoothAdapter {
     */
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    public Set<BluetoothDevice> getBondedDevices() {
        android.util.SeempLog.record(61);
        if (getState() != STATE_ON) {
            return toDeviceSet(new BluetoothDevice[0]);
        }
@@ -1537,6 +1545,7 @@ public final class BluetoothAdapter {
     */
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    public int getProfileConnectionState(int profile) {
        android.util.SeempLog.record(64);
        if (getState() != STATE_ON) return BluetoothProfile.STATE_DISCONNECTED;
        try {
            mServiceLock.readLock().lock();
@@ -1660,6 +1669,7 @@ public final class BluetoothAdapter {
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    public BluetoothServerSocket listenUsingInsecureRfcommWithServiceRecord(String name, UUID uuid)
            throws IOException {
        android.util.SeempLog.record(59);
        return createNewRfcommSocketAndRecord(name, uuid, false, false);
    }

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

@@ -510,6 +511,7 @@ public abstract class ContentResolver {
            @Nullable String[] projection, @Nullable String selection,
            @Nullable String[] selectionArgs, @Nullable String sortOrder,
            @Nullable CancellationSignal cancellationSignal) {
        android.util.SeempLog.record_uri(13, uri);
        Preconditions.checkNotNull(uri, "uri");
        IContentProvider unstableProvider = acquireUnstableProvider(uri);
        if (unstableProvider == null) {
@@ -1264,6 +1266,7 @@ public abstract class ContentResolver {
     */
    public final @Nullable Uri insert(@RequiresPermission.Write @NonNull Uri url,
                @Nullable ContentValues values) {
        android.util.SeempLog.record_uri(37, url);
        Preconditions.checkNotNull(url, "url");
        IContentProvider provider = acquireProvider(url);
        if (provider == null) {
+5 −0
Original line number Diff line number Diff line
@@ -796,6 +796,7 @@ public class Camera {
     * @see android.media.MediaActionSound
     */
    public final void setPreviewCallback(PreviewCallback cb) {
        android.util.SeempLog.record(66);
        mPreviewCallback = cb;
        mOneShot = false;
        mWithBuffer = false;
@@ -822,6 +823,7 @@ public class Camera {
     * @see android.media.MediaActionSound
     */
    public final void setOneShotPreviewCallback(PreviewCallback cb) {
        android.util.SeempLog.record(68);
        mPreviewCallback = cb;
        mOneShot = true;
        mWithBuffer = false;
@@ -860,6 +862,7 @@ public class Camera {
     * @see android.media.MediaActionSound
     */
    public final void setPreviewCallbackWithBuffer(PreviewCallback cb) {
        android.util.SeempLog.record(67);
        mPreviewCallback = cb;
        mOneShot = false;
        mWithBuffer = true;
@@ -1422,6 +1425,7 @@ public class Camera {
     */
    public final void takePicture(ShutterCallback shutter, PictureCallback raw,
            PictureCallback jpeg) {
        android.util.SeempLog.record(65);
        takePicture(shutter, raw, null, jpeg);
    }
    private native final void native_takePicture(int msgType);
@@ -1457,6 +1461,7 @@ public class Camera {
     */
    public final void takePicture(ShutterCallback shutter, PictureCallback raw,
            PictureCallback postview, PictureCallback jpeg) {
        android.util.SeempLog.record(65);
        mShutterCallback = shutter;
        mRawImageCallback = raw;
        mPostviewCallback = postview;
Loading