Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ConnectivityUtil #28

Open
wants to merge 354 commits into
base: 15
Choose a base branch
from
Open

Conversation

u-fred
Copy link

@u-fred u-fred commented Oct 15, 2024

thestinger and others added 30 commits October 15, 2024 13:04
Android 12's privacy dashboard shows permission usage timelines for
location, camera, and microphone. However, there's no reason to limit it
to those specific permissions; all the infrastructure is in place for
other permissions.

To enable the usage timeline for more permissions, keep discrete app op
history for all permission groups shown in the privacy dashboard. The
list of permission group -> app op mappings was obtained from
AppOpsManager.RUNTIME_AND_APPOP_PERMISSION_OPS with a few additional ops
from PrivacyItemController, and each op was resolved to its respective
enum ordinal from frameworks/proto_logging/stats/enums/app/enums.proto.

Change-Id: I6b1c476ea4c0edbc0b3fdf2e3e5cfcb11da77e33
…tivity. (GrapheneOS#2)

This is the partner commit to the addition of an option in Settings for
the same feature. This config can be enabled by an overlay for devices
that support increased touch sensitivity (otherwise known as "Glove
Mode") via the persist.vendor.touch_sensitivity_mode system property.

Signed-off-by: Diab Neiroukh <[email protected]>
India, Japan and Korea have either industry standards or regulations for
phones sold within the country enforcing camera sounds. It's trivially
bypassed by taking out the SIM card, using video, using a headset or
turning off the volume. It doesn't make sense for us to enforce this.
Generated with Android 12 Extensions v9.0.0-test2 [1] using #1565C0
(light link accent color from GrapheneOS website) as a seed color,
with all other settings left at themelib [2] and colorkt [3] defaults.

[1] https://github.com/kdrag0n/android12-extensions/
[2] https://github.com/ProtonAOSP/android_external_themelib
[3] https://github.com/kdrag0n/colorkt
This switches to secure-by-default instead of crash-by-default for API
31 to work around apps which have updated to API 31 without specifying
either FLAG_MUTABLE or FLAG_IMMUTABLE for PendingIntents. If the app
ends up needing the FLAG_MUTABLE behavior, it may crash later, but it
should still be obvious why it happened.

There are many apps with outdated Play services client libraries lacking
support for Android 12 which are nonetheless targeting API 31 or higher
and will crash in certain situations. Google Play services will ask the
client library to request runtime permissions from the user on behalf of
it when it thinks that they're required for an operation that's
requested. The older client libraries will cause a crash in the app by
trying to create a PendingIntent with no FLAG_MUTABLE or FLAG_IMMUTABLE
specified. This is a much more common issue on GrapheneOS since Play
services is a regular user installed app with no special access or
privileges, and starts without any standard runtime permissions granted
to it.

Ported from 13: 94363af7c45a
Co-authored-by: Dmitry Muhomor <[email protected]>
It doesn't make sense to show a generic Android letter version icon for
USB.

Change-Id: I0441fc76fa8beab16675ac91e92e9b0490044dec
This change makes sharesheet way more useful by increasing the amount of
visible ranked apps.

Change-Id: Ic092f1d1784259c9f3c0870eda1dd1ae8544c697
The debugging options are not yet supported probably, so disable exec
spawning when doing debugging.
This reverts commit 5a8d91b5fac0a1ae597de359128e0706776ce3a7.
When an unhandled exception occured, binder connections were closed with
IPCThreadState::stopProcess() before the invocation of java.lang.Thread#dispatchUncaughtException().
By default, that method tries to report the crash via ActivityManager#handleApplicationCrash(),
which always failed due to the closed binder connection.
This meant that the crash dialog was never shown and additional crash handling was skipped.

Zygote-based spawning never calls IPCThreadState::stopProcess().
Needed for exec spawning, to pass custom flags to the kernel.
Chromium browser and its derivatives setup a seccomp syscall filter in their isolated processes,
which blocks creation of new userfaultfds.

Since 14 QPR2, ART uses a new userfaultfd-based GC.

When zygote-based process spawning is used, userfaultfd GC is initialized before any of app's code
is executed, i.e. before Chromium's seccomp syscall filter is installed.

When exec spawning is used, userfaultfd GC initialization is delayed until first garbage collection.
Chromium's seccomp syscall filter is already installed at that point.

This leads to crashes of isolated Chromium processes (both browser and WebView), with the following
log messages:
 E cr_seccomp: ../../sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc:**CRASHING**:seccomp-bpf failure in syscall
 E cr_seccomp: nr=0x11a arg1=0x80001 arg2=0xc arg3=0xffffffffffffffff arg4=0xc

As a workaround, perform early initialization of ART userfaultfd GC in isolated processes by calling
System.gc() before executing app's code. On Pixel 8, this increases startup latency by around 4 to
10 milliseconds.
Add workaround for some PackageManager code not handling package parser cache dir being null,
despite it being nullable upstream.
- ignore SELinux flags on debuggable builds that use kernels without support for SELinux flags
- show a debug-build-only notification when kernel doesn't support SELinux flags
On existing installs, GmsCore uses GSF to perform a one-time migration of GSF databases into
itself.
muhomorr and others added 17 commits October 16, 2024 17:27
Pixel stock OS now enables FRP by default for everyone who has secure lock screen and a Google
account.
That toggle was a no-op due to a recent change.
bac848b removed a null check for defaultAppPackageName.
defaultAppPackageName is null when there's no current Wallet app role holder.

This led to getWalletServiceInfo() returning a reference to an arbitrary app that declared support
for the wallet app interface, if any was present, when there was no current Wallet app role holder.

SystemUI automatically adds wallet quick access tile that links the current Wallet app role holder,
which linked that arbitrary app instead in this case.
Crash report snippet:

signal: 11 (SIGSEGV), code 9 (SEGV_MTESERR), faultAddr 300d6a4a30c285c
threadName: BG Thread GrapheneOS#2

backtrace:
    /product/priv-app/PixelCameraServices/PixelCameraServices.apk!libHdrPlusJni.so (Java_com_google_googlex_gcam_GcamModuleJNI_FrameRequest_1type_1get+0, pc 1495320)
    /system/framework/arm64/boot.oat (art_jni_trampoline+124, pc 9c76c)
    /data/dalvik-cache/arm64/product@priv-app@[email protected]@classes.dex (td.h+2748, pc 46472c)
    /data/dalvik-cache/arm64/product@priv-app@[email protected]@classes.dex (tc.b+104, pc 53bee8)
    /data/dalvik-cache/arm64/product@priv-app@[email protected]@classes.dex (bwv.aq+96, pc 4224f0)
    /data/dalvik-cache/arm64/product@priv-app@[email protected]@classes.dex (cat.run+1016, pc 4239c8)
    /data/dalvik-cache/arm64/product@priv-app@[email protected]@classes.dex (aph.run+180, pc 1a27c4)
    /data/dalvik-cache/arm64/product@priv-app@[email protected]@classes.dex (akd.run+72, pc 17c6a8)
    /data/dalvik-cache/arm64/product@priv-app@[email protected]@classes.dex (bjf.run+464, pc 21ab80)
    /data/dalvik-cache/arm64/product@priv-app@[email protected]@classes.dex (mf.run+2440, pc 305da8)
    /data/dalvik-cache/arm64/product@priv-app@[email protected]@classes.dex (alo.run+404, pc 1810f4)
onUserStopped() method name was misleading, it's called from onUserStopping(), while the user is
still running.

Initial research was done by maade93791 <[email protected]>

Co-authored-by: maade93791 <[email protected]>

ContentResolver cr = context.createContextAsUser(UserHandle.getUserHandleForUid(
uid), 0).getContentResolver();
return Settings.Secure.getInt(cr, Settings.Secure.ALWAYS_ON_VPN_LOCKDOWN, 0) == 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's Settings.Secure.getIntForUser(), no need to create a new Context.

}

public static boolean isRegularAppWithLockdownVpnEnabled(@NonNull Context context, int uid) {
if (isSystem(context, uid)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ALWAYS_ON_VPN_LOCKDOWN check should be done first, it's much faster than isSystem() check in most cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.