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

Commit 3265c258 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Disable SetupRedactionInterstitial when complete" into oc-dev

parents 43458f02 957fc67a
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -17,10 +17,8 @@
package com.android.settings;

import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.UserHandle;
@@ -120,12 +118,6 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric {
                data.putExtra(EXTRA_PASSWORD_QUALITY,
                        lockPatternUtils.getKeyguardStoredPasswordQuality(UserHandle.myUserId()));

                PackageManager packageManager = getPackageManager();
                ComponentName componentName = new ComponentName("com.android.settings",
                        "com.android.settings.SetupRedactionInterstitial");
                packageManager.setComponentEnabledSetting(componentName,
                        PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
                        PackageManager.DONT_KILL_APP);
                super.onActivityResult(requestCode, resultCode, data);
            }
            // If the started activity was cancelled (e.g. the user presses back), then this
+3 −0
Original line number Diff line number Diff line
@@ -87,6 +87,9 @@ public class SetupChooseLockPassword extends ChooseLockPassword {

        @Override
        protected Intent getRedactionInterstitialIntent(Context context) {
            // Setup wizard's redaction interstitial is deferred to optional step. Enable that
            // optional step if the lock screen was set up.
            SetupRedactionInterstitial.setEnabled(context, true);
            return null;
        }
    }
+3 −0
Original line number Diff line number Diff line
@@ -73,6 +73,9 @@ public class SetupChooseLockPattern extends ChooseLockPattern {

        @Override
        protected Intent getRedactionInterstitialIntent(Context context) {
            // Setup wizard's redaction interstitial is deferred to optional step. Enable that
            // optional step if the lock screen was set up.
            SetupRedactionInterstitial.setEnabled(context, false);
            return null;
        }
    }
+17 −3
Original line number Diff line number Diff line
@@ -16,11 +16,11 @@

package com.android.settings;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.android.settings.notification.RedactionInterstitial;

@@ -33,6 +33,20 @@ import com.android.settings.notification.RedactionInterstitial;
 */
public class SetupRedactionInterstitial extends RedactionInterstitial {

    /**
     * Set the enabled state of SetupRedactionInterstitial activity to configure whether it is shown
     * as part of setup wizard's optional steps.
     */
    public static void setEnabled(Context context, boolean enabled) {
        PackageManager packageManager = context.getPackageManager();
        ComponentName componentName = new ComponentName(context, SetupRedactionInterstitial.class);
        packageManager.setComponentEnabledSetting(
                componentName,
                enabled ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
                        : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
                PackageManager.DONT_KILL_APP);
    }

    @Override
    public Intent getIntent() {
        Intent modIntent = new Intent(super.getIntent());
+7 −8
Original line number Diff line number Diff line
@@ -16,7 +16,11 @@

package com.android.settings.notification;

import android.app.admin.DevicePolicyManager;
import static android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_SECURE_NOTIFICATIONS;
import static android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS;

import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
@@ -26,7 +30,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
@@ -34,18 +37,13 @@ import android.widget.TextView;

import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.RestrictedCheckBox;
import com.android.settings.RestrictedRadioButton;
import com.android.settings.SettingsActivity;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.SetupRedactionInterstitial;
import com.android.settings.Utils;
import com.android.settingslib.RestrictedLockUtils;

import static android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_SECURE_NOTIFICATIONS;
import static android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS;

import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;

public class RedactionInterstitial extends SettingsActivity {

    @Override
@@ -128,6 +126,7 @@ public class RedactionInterstitial extends SettingsActivity {
        @Override
        public void onClick(View v) {
            if (v.getId() == R.id.redaction_done_button) {
                SetupRedactionInterstitial.setEnabled(getContext(), false);
                final RedactionInterstitial activity = (RedactionInterstitial) getActivity();
                if (activity != null) {
                    activity.setResult(RESULT_OK, null);