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

Commit 3ba34b6d authored by /e/ robot's avatar /e/ robot
Browse files

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

parents 8f8dba3c 9637d979
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.app;
import static android.content.Context.DISPLAY_SERVICE;
import static android.content.Context.WINDOW_SERVICE;
import static android.view.WindowManager.LayoutParams.TYPE_PRESENTATION;
import static android.view.WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION;

import android.annotation.UnsupportedAppUsage;
import android.content.Context;
@@ -26,18 +27,18 @@ import android.content.res.Resources;
import android.hardware.display.DisplayManager;
import android.hardware.display.DisplayManager.DisplayListener;
import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.ContextThemeWrapper;
import android.view.Display;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;
import android.view.WindowManagerImpl;
import android.os.Handler;
import android.os.Message;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;

/**
 * Base class for presentations.
@@ -116,7 +117,9 @@ import android.util.TypedValue;
 * The display manager keeps track of all displays in the system.  However, not all
 * displays are appropriate for showing presentations.  For example, if an activity
 * attempted to show a presentation on the main display it might obscure its own content
 * (it's like opening a dialog on top of your activity).
 * (it's like opening a dialog on top of your activity).  Creating a presentation on the main
 * display will result in {@link android.view.WindowManager.InvalidDisplayException} being thrown
 * when invoking {@link #show()}.
 * </p><p>
 * Here's how to identify suitable displays for showing presentations using
 * {@link DisplayManager#getDisplays(String)} and the
@@ -189,12 +192,16 @@ public class Presentation extends Dialog {
        mDisplay = display;
        mDisplayManager = (DisplayManager)getContext().getSystemService(DISPLAY_SERVICE);

        final int windowType =
                (display.getFlags() & Display.FLAG_PRIVATE) != 0 ? TYPE_PRIVATE_PRESENTATION
                        : TYPE_PRESENTATION;

        final Window w = getWindow();
        final WindowManager.LayoutParams attr = w.getAttributes();
        attr.token = mToken;
        w.setAttributes(attr);
        w.setGravity(Gravity.FILL);
        w.setType(TYPE_PRESENTATION);
        w.setType(windowType);
        setCanceledOnTouchOutside(false);
    }

@@ -243,7 +250,7 @@ public class Presentation extends Dialog {
    /**
     * Inherited from {@link Dialog#show}. Will throw
     * {@link android.view.WindowManager.InvalidDisplayException} if the specified secondary
     * {@link Display} can't be found.
     * {@link Display} can't be found or if it does not have {@link Display#FLAG_PRESENTATION} set.
     */
    @Override
    public void show() {
+2 −3
Original line number Diff line number Diff line
@@ -90,10 +90,9 @@ public class AppZygote {
    @GuardedBy("mLock")
    private void stopZygoteLocked() {
        if (mZygote != null) {
            // Close the connection and kill the zygote process. This will not cause
            // child processes to be killed by itself.
            mZygote.close();
            Process.killProcess(mZygote.getPid());
            // use killProcessGroup() here, so we kill all untracked children as well.
            Process.killProcessGroup(mZygoteUid, mZygote.getPid());
            mZygote = null;
        }
    }
+1 −0
Original line number Diff line number Diff line
@@ -1260,6 +1260,7 @@ public abstract class DocumentsProvider extends ContentProvider {

            out.putParcelable(DocumentsContract.EXTRA_RESULT, path);
        } else if (METHOD_GET_DOCUMENT_METADATA.equals(method)) {
            enforceReadPermissionInner(documentUri, getCallingPackage(), null);
            return getDocumentMetadata(documentId);
        } else {
            throw new UnsupportedOperationException("Method not supported " + method);
+10 −2
Original line number Diff line number Diff line
@@ -438,8 +438,16 @@ static void UnsetChldSignalHandler() {

// Calls POSIX setgroups() using the int[] object as an argument.
// A nullptr argument is tolerated.
static void SetGids(JNIEnv* env, jintArray managed_gids, fail_fn_t fail_fn) {
static void SetGids(JNIEnv* env, jintArray managed_gids, jboolean is_child_zygote,
                    fail_fn_t fail_fn) {
  if (managed_gids == nullptr) {
    if (is_child_zygote) {
      // For child zygotes like webview and app zygote, we want to clear out
      // any supplemental groups the parent zygote had.
      if (setgroups(0, NULL) == -1) {
        fail_fn(CREATE_ERROR("Failed to remove supplementary groups for child zygote"));
      }
    }
    return;
  }

@@ -1052,7 +1060,7 @@ static void SpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArray gids,
    }
  }

  SetGids(env, gids, fail_fn);
  SetGids(env, gids, is_child_zygote, fail_fn);
  SetRLimits(env, rlimits, fail_fn);

  if (use_native_bridge) {
+10 −2
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ public class AppOpsControllerImpl implements AppOpsController,
    private H mBGHandler;
    private final List<AppOpsController.Callback> mCallbacks = new ArrayList<>();
    private final ArrayMap<Integer, Set<Callback>> mCallbacksByCode = new ArrayMap<>();
    private final PermissionFlagsCache mFlagsCache;
    private boolean mListening;

    @GuardedBy("mActiveItems")
@@ -79,8 +80,14 @@ public class AppOpsControllerImpl implements AppOpsController,

    @Inject
    public AppOpsControllerImpl(Context context, @Named(BG_LOOPER_NAME) Looper bgLooper) {
        this(context, bgLooper, new PermissionFlagsCache(context));
    }

    @VisibleForTesting
    protected AppOpsControllerImpl(Context context, Looper bgLooper, PermissionFlagsCache cache) {
        mContext = context;
        mAppOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
        mFlagsCache = cache;
        mBGHandler = new H(bgLooper);
        final int numOps = OPS.length;
        for (int i = 0; i < numOps; i++) {
@@ -239,7 +246,7 @@ public class AppOpsControllerImpl implements AppOpsController,
        if (permission == null) {
            return false;
        }
        int permFlags = mContext.getPackageManager().getPermissionFlags(permission,
        int permFlags = mFlagsCache.getPermissionFlags(permission,
                packageName, UserHandle.getUserHandleForUid(uid));
        return (permFlags & PackageManager.FLAG_PERMISSION_USER_SENSITIVE_WHEN_GRANTED) != 0;
    }
@@ -359,7 +366,8 @@ public class AppOpsControllerImpl implements AppOpsController,
    }

    private void notifySuscribers(int code, int uid, String packageName, boolean active) {
        if (mCallbacksByCode.containsKey(code)) {
        if (mCallbacksByCode.containsKey(code)
                && isUserVisible(code, uid, packageName)) {
            if (DEBUG) Log.d(TAG, "Notifying of change in package " + packageName);
            for (Callback cb: mCallbacksByCode.get(code)) {
                cb.onActiveStateChanged(code, uid, packageName, active);
Loading