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

Commit 7ef8e2cf authored by /e/ robot's avatar /e/ robot
Browse files

Merge remote-tracking branch 'origin/lineage-17.1' into v1-q

parents 72704380 05fa7e2c
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -2350,7 +2350,10 @@ public abstract class Layout {
        final int ellipsisStringLen = ellipsisString.length();
        // Use the ellipsis string only if there are that at least as many characters to replace.
        final boolean useEllipsisString = ellipsisCount >= ellipsisStringLen;
        for (int i = 0; i < ellipsisCount; i++) {
        final int min = Math.max(0, start - ellipsisStart - lineStart);
        final int max = Math.min(ellipsisCount, end - ellipsisStart - lineStart);

        for (int i = min; i < max; i++) {
            final char c;
            if (useEllipsisString && i < ellipsisStringLen) {
                c = ellipsisString.charAt(i);
@@ -2359,11 +2362,9 @@ public abstract class Layout {
            }

            final int a = i + ellipsisStart + lineStart;
            if (start <= a && a < end) {
            dest[destoff + a - start] = c;
        }
    }
    }

    /**
     * Stores information about bidirectional (left-to-right or right-to-left)
+5 −7
Original line number Diff line number Diff line
@@ -90,7 +90,6 @@ import com.android.internal.util.MemInfoReader;
import com.android.internal.util.Preconditions;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -759,8 +758,7 @@ final class ActivityManagerShellCommand extends ShellCommand {
            return -1;
        }

        File file = new File(filename);
        file.delete();
        // Writes an error message to stderr on failure
        ParcelFileDescriptor fd = openFileForSystem(filename, "w");
        if (fd == null) {
            return -1;
@@ -914,16 +912,16 @@ final class ActivityManagerShellCommand extends ShellCommand {
            t.set(System.currentTimeMillis());
            heapFile = "/data/local/tmp/heapdump-" + t.format("%Y%m%d-%H%M%S") + ".prof";
        }
        pw.println("File: " + heapFile);
        pw.flush();

        File file = new File(heapFile);
        file.delete();
        // Writes an error message to stderr on failure
        ParcelFileDescriptor fd = openFileForSystem(heapFile, "w");
        if (fd == null) {
            return -1;
        }

        pw.println("File: " + heapFile);
        pw.flush();

        final CountDownLatch latch = new CountDownLatch(1);

        final RemoteCallback finishCallback = new RemoteCallback(new OnResultListener() {
+28 −7
Original line number Diff line number Diff line
@@ -113,6 +113,7 @@ import android.app.IActivityManager;
import android.app.INotificationManager;
import android.app.ITransientNotification;
import android.app.IUriGrantsManager;
import android.app.KeyguardManager;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationChannelGroup;
@@ -432,6 +433,8 @@ public class NotificationManagerService extends SystemService {
    final ArrayMap<String, NotificationRecord> mSummaryByGroupKey = new ArrayMap<>();
    final ArrayMap<String, Long> mLastSoundTimestamps = new ArrayMap<>();

    private KeyguardManager mKeyguardManager;

    // The last key in this list owns the hardware.
    ArrayList<String> mLights = new ArrayList<>();

@@ -1517,6 +1520,11 @@ public class NotificationManagerService extends SystemService {
        mAudioManager = audioMananger;
    }

    @VisibleForTesting
    void setKeyguardManager(KeyguardManager keyguardManager) {
        mKeyguardManager = keyguardManager;
    }

    @VisibleForTesting
    void setHints(int hints) {
        mListenerHints = hints;
@@ -1977,6 +1985,7 @@ public class NotificationManagerService extends SystemService {
            mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
            mAudioManagerInternal = getLocalService(AudioManagerInternal.class);
            mWindowManagerInternal = LocalServices.getService(WindowManagerInternal.class);
            mKeyguardManager = getContext().getSystemService(KeyguardManager.class);
            mZenModeHelper.onSystemReady();
            mRoleObserver = new RoleObserver(getContext().getSystemService(RoleManager.class),
                    mPackageManager, getContext().getMainExecutor());
@@ -5972,7 +5981,6 @@ public class NotificationManagerService extends SystemService {
        boolean beep = false;
        boolean blink = false;

        final Notification notification = record.sbn.getNotification();
        final String key = record.getKey();

        // Should this notification make noise, vibe, or use the LED?
@@ -5991,7 +5999,7 @@ public class NotificationManagerService extends SystemService {
        // If the notification will appear in the status bar, it should send an accessibility
        // event
        if (!record.isUpdate && record.getImportance() > IMPORTANCE_MIN) {
            sendAccessibilityEvent(notification, record.sbn.getPackageName());
            sendAccessibilityEvent(record);
            sentAccessibilityEvent = true;
        }

@@ -6016,7 +6024,7 @@ public class NotificationManagerService extends SystemService {
                if (hasAudibleAlert && !shouldMuteNotificationLocked(record)
                        && !isInSoundTimeoutPeriod(record)) {
                    if (!sentAccessibilityEvent) {
                        sendAccessibilityEvent(notification, record.sbn.getPackageName());
                        sendAccessibilityEvent(record);
                        sentAccessibilityEvent = true;
                    }
                    if (DBG) Slog.v(TAG, "Interrupting!");
@@ -6720,17 +6728,30 @@ public class NotificationManagerService extends SystemService {
        return (x < low) ? low : ((x > high) ? high : x);
    }

    void sendAccessibilityEvent(Notification notification, CharSequence packageName) {
    void sendAccessibilityEvent(NotificationRecord record) {
        if (!mAccessibilityManager.isEnabled()) {
            return;
        }

        AccessibilityEvent event =
        final Notification notification = record.getNotification();
        final CharSequence packageName = record.sbn.getPackageName();
        final AccessibilityEvent event =
            AccessibilityEvent.obtain(AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED);
        event.setPackageName(packageName);
        event.setClassName(Notification.class.getName());
        final int visibilityOverride = record.getPackageVisibilityOverride();
        final int notifVisibility = visibilityOverride == NotificationManager.VISIBILITY_NO_OVERRIDE
                ? notification.visibility : visibilityOverride;
        final int userId = record.getUser().getIdentifier();
        final boolean needPublic = userId >= 0 && mKeyguardManager.isDeviceLocked(userId);
        if (needPublic && notifVisibility != Notification.VISIBILITY_PUBLIC) {
            // Emit the public version if we're on the lockscreen and this notification isn't
            // publicly visible.
            event.setParcelableData(notification.publicVersion);
        } else {
            event.setParcelableData(notification);
        CharSequence tickerText = notification.tickerText;
        }
        final CharSequence tickerText = notification.tickerText;
        if (!TextUtils.isEmpty(tickerText)) {
            event.getText().add(tickerText);
        }
+11 −1
Original line number Diff line number Diff line
@@ -695,6 +695,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {

    private int mPowerButtonSuppressionDelayMillis = POWER_BUTTON_SUPPRESSION_DELAY_DEFAULT_MILLIS;

    private boolean mLockNowPending = false;

    private final List<DeviceKeyHandler> mDeviceKeyHandlers = new ArrayList<>();

    private LineageButtons mLineageButtons;
@@ -5762,6 +5764,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    mKeyguardDelegate.doKeyguardTimeout(options);
                }
                mLockScreenTimerActive = false;
                mLockNowPending = false;
                options = null;
            }
        }
@@ -5771,7 +5774,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        }
    }

    ScreenLockTimeout mScreenLockTimeout = new ScreenLockTimeout();
    final ScreenLockTimeout mScreenLockTimeout = new ScreenLockTimeout();

    @Override
    public void lockNow(Bundle options) {
@@ -5783,6 +5786,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            mScreenLockTimeout.setLockOptions(options);
        }
        mHandler.post(mScreenLockTimeout);
        synchronized (mScreenLockTimeout) {
            mLockNowPending = true;
        }
    }

    // TODO (b/113840485): Move this logic to DisplayPolicy when lockscreen supports multi-display.
@@ -5798,6 +5804,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {

    private void updateLockScreenTimeout() {
        synchronized (mScreenLockTimeout) {
            if (mLockNowPending) {
                Log.w(TAG, "lockNow pending, ignore updating lockscreen timeout");
                return;
            }
            final boolean enable = !mAllowLockscreenWhenOnDisplays.isEmpty()
                    && mDefaultDisplayPolicy.isAwake()
                    && mKeyguardDelegate != null && mKeyguardDelegate.isSecure(mCurrentUserId);
+6 −0
Original line number Diff line number Diff line
@@ -637,6 +637,12 @@ public class RoleManagerService extends SystemService implements RoleUserState.C

        @Override
        public String getDefaultSmsPackage(int userId) {
            userId = handleIncomingUser(userId, false, "getDefaultSmsPackage");
            if (!mUserManagerInternal.exists(userId)) {
                Slog.e(LOG_TAG, "user " + userId + " does not exist");
                return null;
            }

            long identity = Binder.clearCallingIdentity();
            try {
                return CollectionUtils.firstOrNull(
Loading