* Resolve the real image format before choosing the encoder
The upload pre-processor picks the encoder from the mime type it is
given. When an image is shared from another app that type is often
broader than the image really is, so a transparent PNG shared as a
wildcard image type is re-encoded as JPEG and its alpha channel is
flattened to black.
Read the format from the image header when the declared type is not
already a concrete PNG or JPEG, and use that to decide both whether the
image can be compressed at all and which encoder to use.
* Cover the mime type fallbacks the wildcard resolution introduced
resolveImageMimeType now decides whether an image is compressible, so two of
its outcomes had no test: a GIF shared with a wildcard type has to be
recognised and left uncompressed rather than recompressed into a still, and a
file the decoder cannot read at all has to fall back to the type it was shared
with.
The isMimeTypeImage() guard on the decoded type is dropped with them. The
BitmapFactory decoders only ever report an image type in outMimeType, so the
guard could not fire and there was no way to exercise it.
* Update dependency org.matrix.rustcomponents:sdk-android to v26.08.17
* Fix API breaks:
- `ClientBuildException.WellKnownLookupDisabled` should be handled now.
- `Client.sendReply` returns a `Result<SendHandle>` now. We can ignore it like we do for `Client.send`.
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jorge Martín <jorgem@element.io>
* Extract `IsEnterpriseBuild` use case
Having it inside `EnterpriseService` made having DI cycles with the `BuildMeta` provider too easy
* Rename `EnterpriseService.defaultHomeserverList()` to `homeserverAllowList()`
This seems more aligned with the way this list works
* Move most of the logic from `:libraries:wellknown` to `:enterprise:feature:enterprise`, both `shared` and `impl` modules
Ideally I would have added everything into `impl`, but some of the classes needed to be shared between the different `:enterprise:features` modules, and those are in the `shared` module, lacking a better name/strategy
* Add `EnterpriseService.isElementProEnforced`
With this, we don't need to provide the `RemoteEnterpriseConfig` anymore to any consumers, everything goes through `EnterpriseService` or other providers
* Remove `EnterpriseService.overriddenElementWellKnown`
This leaks the remote enterprise config/element well known contents to the app in a public interface.
* Create `CustomMapTilerConfigProvider` to avoid leaking the `RemoteEnterpriseConfig` in public APIs
This commit also starts moving some of the well-known related values to the enterprise modules
* Add missing docs to `EnterpriseService` and `SessionEnterpriseService`
* Fix tests
* Fix lint issues
* Bump enterprise module
* Explain a rate limiting push gateway in the notification troubleshooter
The push loop back test printed whatever HTTP status the gateway
answered, so a user throttled by the public ntfy.sh gateway was told
"Error: HTTP 507", which reads as a server fault rather than as a quota
they can wait out or move away from.
Map the two statuses that mean the notification was throttled onto a
typed failure and give the troubleshooter a message that says what to do.
* Import strings from localazy, remove `temporary.xml` in `:libraries:push:impl`
---------
Co-authored-by: Jorge Martín <jorgem@element.io>
Images are downscaled against a 640px reference, which makes inSampleSize
halve the source one step further than the documented intent: the KDoc
says images should be sent at up to 1280x1280, but a 12000x3916 photo is
sent as 3006x979. Text in screenshots and detail in photos is lost at
that size.
Raise the reference to 1280. inSampleSize is a power of two, so this
moves each image one step up rather than to an exact size.
A slash is valid in the local part of a user id, but in a permalink it
also separates the identifier from an event id, so the SDK could not tell
the two apart and the link fell back to opening matrix.to in a browser.
Only a user id can start with an @, so recover it before handing the URI
to the SDK, and only when the identifier really contains a slash so every
other permalink keeps taking the same path.
Adding or editing a media caption from the plain composer sent the
caption as text only: the composer has no HTML to pass, and the media
caption edit was built by hand with a null formatted body, so the
markdown was never rendered. Sending a caption with the same markdown
does render it, because the SDK builds the formatted body there.
Build the edit with the SDK's createCaptionEdit, which runs the caption
through the same markdown conversion the send path uses.
Cover the last remaining interfaces across libraries/audio, libraries/cachestore,
libraries/indicator, libraries/slashcommands, libraries/voiceplayer and
services/apperror, with their members and parameters.
This completes the effort: all 222 in-scope interfaces and their 820 members in
the 60 api modules that hold any now carry documentation.
Notable points: CacheStore applies no expiry of its own and only records when each
entry was written, leaving staleness to the caller; SlashCommandService.parse
never throws, returning NotACommand for ordinary text and an error case for a
malformed command.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document the members of SecretKeyRepository and EncryptionDecryptionService.
The caveat worth having in the API doc comes from KeyStoreSecretKeyRepository:
requiresUserAuthentication only takes effect when the key is created, so an
existing key keeps whatever protection it was created with.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Cover the remaining interfaces of libraries/troubleshoot, libraries/matrixmedia,
libraries/dateformatter, libraries/featureflag, libraries/workmanager and
libraries/mediaviewer, along with their members and parameters.
Behaviours worth recording: NotificationTroubleshootTest reports its outcome
through its state flow rather than by returning, and its quickFix throws unless
the test offers one; DateFormatter.format turns a null timestamp into an empty
string so callers need no null check; ImageLoaderHolder keeps one loader per
session because decrypting room media needs that session's client.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document PickerProvider and each of its register methods.
The interface doc carries the two rules that apply to all of them: they must be
called during composition rather than from a click handler, and a cancelled pick
arrives as a null uri or an empty list rather than as an error.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document PusherSubscriber and PushHandler at the interface level, document the
PushProvider members that had none, and add the missing @param entries.
Notable points: getCurrentDistributor also returns null when the stored
distributor is no longer installed, rotateToken throws unless canRotateToken is
true, and handleInvalid records the payload in the push history for diagnosis.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document SessionStore, SessionObserver and SessionListener at the interface level
and add the missing @param entries.
The store doc records that sessions are ordered by last usage, which is what makes
"the latest session" meaningful across the rest of the interface, and the listener
doc explains that wasLastSession is the signal to clean up app-wide data too.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document OAuthIntentResolver and OAuthActionFlow along with their members.
OAuthActionFlow now explains why it exists rather than the result simply being
returned: the activity that receives the redirect and the login screen waiting for
it are not in the same navigation subtree.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document UserRepository and UserListDataSource along with their members.
Two behaviours from MatrixUserRepository and MatrixUserListDataSource are recorded
because callers rely on them: the data source swallows a failed directory request
into an empty list, and a query that is a well-formed user id other than the
current user's yields that user even when the directory does not know them.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document RoomLatestEventFormatter, TimelineEventFormatter and
PinnedMessagesBannerFormatter along with their members.
The formatters return a nullable CharSequence, so each one now states what null
means: the event is not rendered as text at all.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document DeeplinkParser, DeepLinkCreator and InviteFriendsUseCase, including that
DeepLinkCreator.create silently ignores the deeper arguments once an outer one is
null.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document PermissionsStore, PermissionStateProvider, LocalNetworkPermissionAdvisor
and the PermissionsPresenter factory, along with their members and parameters.
The store doc explains why the module exists: Android does not let an app
distinguish "never asked" from "asked and denied", so the app has to remember
that itself in order to decide whether it may show a rationale.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document UserPushStore, UserPushStoreFactory, PushClientSecret,
PushClientSecretStore and PushClientSecretFactory along with all their members.
The client secret interfaces now explain why they exist at all: a push gateway
delivers notifications without saying which account they belong to, so the secret
is what lets an incoming push be attributed back to a session.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document WellknownRetriever, ElementWellknownStore, ElementWellKnownParser and
their factories, along with every member.
The caching semantics are the part callers need and cannot see in the signatures,
so they are recorded here: the store reports entries older than a day as outdated
rather than missing, the retriever returns such a value immediately and refreshes
in the background, an enterprise build with a hardcoded configuration
short-circuits entirely, and the parser ignores unknown JSON fields.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document MediaSender and all its members, its two factories, MediaPreProcessor,
MaxUploadSizeProvider and MediaOptimizationConfigProvider.
The MediaSender doc explains the two-step shape of the API, which the individual
signatures do not convey: pre-processing and sending are separate so a preview
can be shown in between, and the temporary files that pre-processing creates are
only released by cleanUp, whether or not anything was ultimately sent.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document AddRecentEmoji, GetRecentEmojis.invoke, the EmojiPickerRenderer
interface and the EmojiPickerPresenter factory, pointing at the no-op renderer
and the empty recent-emoji source so callers know how to opt out of each.
EmojiPickerPresenter itself is a Presenter and therefore out of scope.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document AppPreferencesStore, SessionPreferencesStore, their two factories, and
each of their 44 members.
For a preference store the useful thing to document is the fallback value, so
each getter states the default it uses when the preference has never been set,
taken from DefaultAppPreferencesStore and DefaultSessionPreferencesStore:
developer mode follows the build type, live location updates default to 10
metres, the log packs to an empty set, and the session toggles are all on by
default except session verification skipping.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document PushService, GetCurrentPushProvider, NotificationCleaner and
NotificationBitmapLoader along with their members, and add the missing @param
entries across the notification interfaces.
The NotificationCleaner docs record the behaviour shared by all its methods,
which is not visible in the signatures: each one also removes the grouping
summary notification once it has no children left.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document the permalink, widget, tracing, core, platform, server and analytics
interfaces along with their members, which completes libraries/matrix/api: all
69 in-scope interfaces and their 398 members now carry documentation.
Notable points recorded here: PermalinkParser reports an unrecognised uri as a
fallback link rather than failing, MatrixWidgetDriver.run is a no-op while it is
already running and send is silently ignored once closed, and every member of
CallAnalyticCredentialsProvider is null when the service is unconfigured or the
user has not consented to analytics.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document NotificationSettingsService and PushersService along with all their
members, and complete the NotificationService documentation.
Fix the documentation of notificationSettingsChangeFlow, which described a state
flow of room notification settings when the member is a SharedFlow<Unit> that
only signals that the push rules changed. That was the sole reference to
RoomNotificationSettingsState in the file, so its now unused import is removed.
The docs also explain why so many of these methods take isEncrypted and
isOneToOne: Matrix keeps a separate default push rule per combination.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Add the interface level docs that MediaPreviewService, MatrixMediaLoader and
MxcTools were missing, document MediaFile.path and the nested
ContentScannerUrlProvider.Factory, and add the missing @param entries.
Most members in these packages already had accurate documentation and are left
untouched.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document RoomDirectoryService, RoomDirectoryList, SpaceService, SpaceRoomList
and LeaveSpaceHandle along with their members, add the missing DynamicRoomList
page size doc and the missing @param entries, and give MessageSearchService the
interface level doc it was lacking.
The docs make the ownership rules explicit, since they differ across these
types: a SpaceRoomList and a LeaveSpaceHandle are owned by the caller and must be
destroyed or closed, while a RoomDirectoryList and a MessageSearch are released
when the scope they were created with completes.
RoomList, RoomListService and the search interfaces were already accurate and are
left untouched.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document MatrixAuthenticationService, OAuthRedirectUrlProvider, the two QR code
login data interfaces, and the four device linking interfaces, along with their
members and parameters.
The docs record the ordering constraints a caller has to respect: setHomeserver
must precede any login attempt, the link handlers report their outcome through
their step flow rather than through a return value, and ContinuationMessageSender
expects exactly one of cancel or confirm.
The oauth package holds only a sealed interface, so it is out of scope here.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document EncryptionService, SessionVerificationService and
SessionVerificationServiceListener along with their members, and add the missing
@param entries.
From RustEncryptionService: the backup and recovery state flows report a
waiting-for-sync value for as long as the session is not syncing, and
isLastDevice and hasDevicesToVerifyAgainst are polled rather than observed.
PasswordStrengthEstimator was already accurate and is left untouched.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document Timeline and all of its members, TimelineProvider, and the three
lazy providers carried by EventTimelineItem.
Behaviours taken from RustTimeline: collecting membershipChangeEventReceived or
onSyncedEventReceived is what keeps the timeline subscribed to the SDK, paginate
fails with CannotPaginate when the matching status forbids it, the initial
hasMoreToLoad of each pagination status depends on the timeline mode,
timelineItems also carries virtual items such as date separators, and the media
send functions return a handler the caller must await.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document KnockRequest and ThreadsListService along with all their members, and
add the missing @param entries to the already documented RoomPermissions.
For ThreadsListService the docs record what the implementation does with the
subscriptions: subscribeToItemUpdates starts a shared subscription on the first
call and re-emits the whole list, subscribeToPaginationUpdates replays the
current state immediately, and destroy leaves the service unusable.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document BaseRoom, JoinedRoom, NotJoinedRoom, RoomAliasHelper and JoinRoom,
along with their members, and add the missing @param entries.
Fix the documentation of BaseRoom.getUpdatedIsEncrypted, which described the
room directory visibility instead of the encryption state it actually returns.
Behaviours taken from the implementations: BaseRoom.predecessorRoom swallows
errors into null, updateMembers only reads the cache on its first call,
JoinedRoom.syncUpdateFlow is an opaque change counter, notification settings
start in an Unknown state until updateRoomNotificationSettings is called, and
JoinRoom maps a Forbidden answer to Failures.UnauthorizedJoin.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document the interface itself and all of its 60+ properties and functions.
Notable behaviours taken from RustMatrixClient that callers cannot guess from
the signatures: getRoom and getJoinedRoom build a new closeable instance on
every call, createRoom/joinRoom/knockRoom wait for the membership to come back
through sync and report a null RoomInfo rather than a failure when that wait
times out, getCacheSize excludes the crypto database, and clearCache destroys
the client while keeping the session.
Also fix the stale wording and the malformed KDoc block on resolveRoomAlias,
and add the missing @param entries on the functions that already had a summary.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document MatrixClientProvider, SdkMetadata, HomeserverCapabilitiesProvider,
TemporaryMatrixClientFactory and SyncService, along with each of their members.
Behaviour described here was checked against the implementations
(MatrixSessionCache, RustSdkMetadata, RustHomeserverCapabilitiesProvider,
RustTemporaryMatrixClientFactory and RustSyncService), so the docs mention the
caching, idempotence and error-wrapping that callers cannot infer from the
signatures alone.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
We modify the existing `FeaturesProvider` interface so that there can be more
than one of them, and the Features provided by *all* of the instances are
shown. We can then make another instance in element-android-enterprise, which
exposes enterprise-only features.