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

Commit cd941213 authored by Nick Kralevich's avatar Nick Kralevich
Browse files

Revert more integrity check changes.

The integrity checking features never shipped as part of a release.
Delete the stale code.

This conceptually reverts the following commits:

  * c7d64c13
  * ee2b4928

Test: Device boots and no obvious problems.
Change-Id: I8d1589b38ddbcdf26f5132476b8cdfba7ef439cd
parent d0835e45
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -4440,11 +4440,6 @@
    <!-- Text of button to allow user to abort countdown and immediately start another session in retail demo mode [CHAR LIMIT=40] -->
    <string name="demo_user_inactivity_timeout_right_button">Reset now</string>

    <!-- Title of notification shown when device has been forced to safe mode after a security compromise. -->
    <string name="audit_safemode_notification">Factory reset to use this device without restrictions</string>
    <!-- Description of notification shown when device has been forced to safe mode after a security compromise. -->
    <string name="audit_safemode_notification_details">Touch to learn more.</string>

    <!-- Accessibilty string added to a widget that has been suspended [CHAR LIMIT=20] -->
    <string name="suspended_widget_accessibility">Disabled <xliff:g id="label" example="Calendar">%1$s</xliff:g></string>

+0 −2
Original line number Diff line number Diff line
@@ -1920,8 +1920,6 @@
  <java-symbol type="string" name="config_customVpnConfirmDialogComponent" />
  <java-symbol type="string" name="config_defaultNetworkScorerPackageName" />
  <java-symbol type="string" name="config_persistentDataPackageName" />
  <java-symbol type="string" name="audit_safemode_notification" />
  <java-symbol type="string" name="audit_safemode_notification_details" />
  <java-symbol type="string" name="reset_retail_demo_mode_title" />
  <java-symbol type="string" name="reset_retail_demo_mode_text" />
  <java-symbol type="string" name="demo_user_inactivity_timeout_title" />
+0 −3
Original line number Diff line number Diff line
@@ -94,9 +94,6 @@ public final class ShutdownThread extends Thread {
    public static final String REBOOT_SAFEMODE_PROPERTY = "persist.sys.safemode";
    public static final String RO_SAFEMODE_PROPERTY = "ro.sys.safemode";

    // Indicates whether we should stay in safe mode until ro.build.date.utc is newer than this
    public static final String AUDIT_SAFEMODE_PROPERTY = "persist.sys.audit_safemode";

    // static instance of this thread
    private static final ShutdownThread sInstance = new ShutdownThread();

+2 −51
Original line number Diff line number Diff line
@@ -25,9 +25,6 @@ import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
import android.app.AppOpsManager;
import android.app.IActivityManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
@@ -331,8 +328,6 @@ public class WindowManagerService extends IWindowManager.Stub

    private static final float DRAG_SHADOW_ALPHA_TRANSPARENT = .7071f;

    private static final String PROPERTY_BUILD_DATE_UTC = "ro.build.date.utc";

    // Enums for animation scale update types.
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({WINDOW_ANIMATION_SCALE, TRANSITION_ANIMATION_SCALE, ANIMATION_DURATION_SCALE})
@@ -5974,35 +5969,6 @@ public class WindowManagerService extends IWindowManager.Stub
                mFocusedApp.mTask.mStack : null;
    }

    private void showAuditSafeModeNotification() {
        PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0,
                new Intent(Intent.ACTION_VIEW,
                           Uri.parse("https://support.google.com/nexus/answer/2852139")), 0);

        String title = mContext.getString(R.string.audit_safemode_notification);

        Notification notification = new Notification.Builder(mContext)
                .setSmallIcon(com.android.internal.R.drawable.stat_sys_warning)
                .setWhen(0)
                .setOngoing(true)
                .setTicker(title)
                .setLocalOnly(true)
                .setPriority(Notification.PRIORITY_HIGH)
                .setVisibility(Notification.VISIBILITY_PUBLIC)
                .setColor(mContext.getColor(
                        com.android.internal.R.color.system_notification_accent_color))
                .setContentTitle(title)
                .setContentText(mContext.getString(R.string.audit_safemode_notification_details))
                .setContentIntent(pendingIntent)
                .build();

        NotificationManager notificationManager = (NotificationManager) mContext
                .getSystemService(Context.NOTIFICATION_SERVICE);

        notificationManager.notifyAsUser(null, R.string.audit_safemode_notification, notification,
                UserHandle.ALL);
    }

    public boolean detectSafeMode() {
        if (!mInputMonitor.waitForInputDevicesReady(
                INPUT_DEVICES_READY_FOR_SAFE_MODE_DETECTION_TIMEOUT_MILLIS)) {
@@ -6030,23 +5996,8 @@ public class WindowManagerService extends IWindowManager.Stub
        try {
            if (SystemProperties.getInt(ShutdownThread.REBOOT_SAFEMODE_PROPERTY, 0) != 0
                    || SystemProperties.getInt(ShutdownThread.RO_SAFEMODE_PROPERTY, 0) != 0) {
                int auditSafeMode = SystemProperties.getInt(ShutdownThread.AUDIT_SAFEMODE_PROPERTY, 0);

                if (auditSafeMode == 0) {
                mSafeMode = true;
                SystemProperties.set(ShutdownThread.REBOOT_SAFEMODE_PROPERTY, "");
                } else {
                    // stay in safe mode until we have updated to a newer build
                    int buildDate = SystemProperties.getInt(PROPERTY_BUILD_DATE_UTC, 0);

                    if (auditSafeMode >= buildDate) {
                        mSafeMode = true;
                        showAuditSafeModeNotification();
                    } else {
                        SystemProperties.set(ShutdownThread.REBOOT_SAFEMODE_PROPERTY, "");
                        SystemProperties.set(ShutdownThread.AUDIT_SAFEMODE_PROPERTY, "");
                    }
                }
            }
        } catch (IllegalArgumentException e) {
        }