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

Commit 9da385fc authored by Bruno Martins's avatar Bruno Martins
Browse files

LocationSettingsActivity: Send broadcast as user

 * Specify the user the broadcast will be sent to,
   in order to avoid the warnings as seen in the logs:

     W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1531 android.content.ContextWrapper.startService:664 org.lineageos.setupwizard.SetupWizardExitActivity.onCreate:53 android.app.Activity.performCreate:7136 android.app.Activity.performCreate:7127

Change-Id: I26a0b4ab2dc94bbe6eff065875901bf347aec85b
parent 4b465ba4
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (C) 2016 The CyanogenMod Project
 * Copyright (C) 2016 The CyanogenMod Project
 * Copyright (C) 2017 The LineageOS Project
 * Copyright (C) 2017-2018 The LineageOS Project
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ package org.lineageos.setupwizard;
import android.content.ContentResolver;
import android.content.ContentResolver;
import android.content.Intent;
import android.content.Intent;
import android.os.Bundle;
import android.os.Bundle;
import android.os.UserHandle;
import android.provider.Settings;
import android.provider.Settings;
import android.util.Log;
import android.util.Log;
import android.view.View;
import android.view.View;
@@ -128,7 +129,8 @@ public class LocationSettingsActivity extends BaseSetupWizardActivity {
        Intent intent = new Intent(MODE_CHANGING_ACTION);
        Intent intent = new Intent(MODE_CHANGING_ACTION);
        intent.putExtra(CURRENT_MODE_KEY, mCurrentMode);
        intent.putExtra(CURRENT_MODE_KEY, mCurrentMode);
        intent.putExtra(NEW_MODE_KEY, mode);
        intent.putExtra(NEW_MODE_KEY, mode);
        sendBroadcast(intent, android.Manifest.permission.WRITE_SECURE_SETTINGS);
        sendBroadcastAsUser(intent, new UserHandle(UserHandle.USER_CURRENT),
                android.Manifest.permission.WRITE_SECURE_SETTINGS);
        Settings.Secure.putInt(mContentResolver, Settings.Secure.LOCATION_MODE, mode);
        Settings.Secure.putInt(mContentResolver, Settings.Secure.LOCATION_MODE, mode);
        refreshLocationMode();
        refreshLocationMode();
    }
    }