# Lemenzo Gallery system integration (Android 16)

## 1. Source location
Place this directory at `packages/apps/LemenzoGallery`.

## 2. Product inclusion
Include `integration/lemenzo_gallery_product.mk` from the common LemenzoOS product makefile, or apply the two PRODUCT_PACKAGES lines there. This removes legacy `Gallery2` and includes `LemenzoGallery`.

## 3. System placement and permissions
The app is a normal preinstalled system app, not a privileged app. Android 16's OEM-only `SYSTEM_GALLERY` role is the single source of truth for gallery media access. The manifest requests `READ_MEDIA_IMAGES`, `READ_MEDIA_VIDEO`, `READ_MEDIA_VISUAL_USER_SELECTED`, and `ACCESS_MEDIA_LOCATION`; PermissionController grants the role-appropriate access/app-ops when `config_systemGallery` points to `com.lemenzo.gallery`. No separate default-permissions exception is installed. No INTERNET or MANAGE_EXTERNAL_STORAGE permission is used.

## 4. Android media intents
`ViewerActivity` handles `ACTION_VIEW` for `image/*` and `video/*`; `EditorActivity` handles `ACTION_EDIT` for `image/*`. External content URIs can be viewed even when they are not members of MediaStore; MediaStore-only destructive controls are hidden for those one-off URIs.

## 5. Lemenzo Camera handoff
Camera should use a package-scoped standard VIEW intent, preserving the content grant:

```java
Intent view = new Intent(Intent.ACTION_VIEW)
        .setDataAndType(mediaUri, mimeType)
        .setPackage("com.lemenzo.gallery")
        .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(view);
```

The standard ACTION_VIEW contract avoids a private cross-app API and lets other trusted system apps use the same viewer.

## 6. Build/test gate
`m LemenzoGallery LemenzoGalleryTests`
`atest LemenzoGalleryTests`

Do not add a privapp allowlist unless a future version truly requests a signature|privileged permission. Current Gallery code does not need one.

The LemenzoOS framework overlay must set:
`config_systemGallery = com.lemenzo.gallery`
`config_systemImageEditor = com.lemenzo.gallery/com.lemenzo.gallery.editor.EditorActivity`
