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

Commit 5771ea9e authored by Jack Yu's avatar Jack Yu
Browse files

Fixed activity not started for current user

In headless mode, the activity started by the phone process needs
to be started for the current user, because phone process is always
running as the system user, and the actual user is running as
the secondary user.

Fix: 365861945
Test: Basic telephony functionality tests
Test: atest FrameworksTelephonyTests
Test: atest TeleServiceTests
Flag: EXEMPT bug fix
Change-Id: Ibaeeb67b64224d7eea39287d1e0dc8cfbdc3ef83
parent 5b89b0ca
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -2154,8 +2154,9 @@ public abstract class InboundSmsHandler extends StateMachine {
                UserManager userManager =
                        (UserManager) context.getSystemService(Context.USER_SERVICE);
                if (userManager.isUserUnlocked()) {
                    context.startActivity(context.getPackageManager().getLaunchIntentForPackage(
                            Telephony.Sms.getDefaultSmsPackage(context)));
                    context.startActivityAsUser(context.getPackageManager()
                            .getLaunchIntentForPackage(Telephony.Sms.getDefaultSmsPackage(context)),
                            UserHandle.CURRENT);
                }
            }
        }
+2 −1
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.telephony.DropBoxManagerLoggerBackend;
import android.telephony.PersistentLogger;
import android.telephony.Rlog;
@@ -426,7 +427,7 @@ public class PointingAppController {
            mLastNeedFullScreenPointingUI = needFullScreenPointingUI;
            mLastIsDemoMode = isDemoMode;
            mLastIsEmergency = isEmergency;
            mContext.startActivity(launchIntent);
            mContext.startActivityAsUser(launchIntent, UserHandle.CURRENT);
        } catch (ActivityNotFoundException ex) {
            ploge("startPointingUI: Pointing UI app activity is not found, ex=" + ex);
        }
+3 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.UserHandle;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
@@ -107,7 +108,8 @@ public class InstallCarrierAppTrampolineActivity extends Activity {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == INSTALL_CARRIER_APP_DIALOG_REQUEST) {
            if (resultCode == DOWNLOAD_RESULT) {
                startActivity(InstallCarrierAppUtils.getPlayStoreIntent(mPackageName));
                startActivityAsUser(InstallCarrierAppUtils.getPlayStoreIntent(mPackageName),
                        UserHandle.CURRENT);
            }
            finishNoAnimation();
        }
+2 −1
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.os.ParcelUuid;
import android.os.PersistableBundle;
import android.os.Registrant;
import android.os.RegistrantList;
import android.os.UserHandle;
import android.os.UserManager;
import android.preference.PreferenceManager;
import android.provider.Settings;
@@ -1356,7 +1357,7 @@ public class UiccProfile extends IccCard {
    private void promptInstallCarrierApp(String pkgName) {
        Intent showDialogIntent = InstallCarrierAppTrampolineActivity.get(mContext, pkgName);
        showDialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        mContext.startActivity(showDialogIntent);
        mContext.startActivityAsUser(showDialogIntent, UserHandle.CURRENT);
    }

    private void onCarrierPrivilegesLoadedMessage() {
+3 −0
Original line number Diff line number Diff line
@@ -687,6 +687,9 @@ public class ContextFixture implements TestFixture<Context> {

        @Override
        public void startActivity(Intent intent) {}

        @Override
        public void startActivityAsUser(Intent intent, UserHandle user) {}
    }

    private final Multimap<String, ComponentName> mComponentNamesByAction =
Loading