summaryrefslogtreecommitdiff
path: root/java
AgeCommit message (Collapse)Author
2024-03-28Import translations. DO NOT MERGE ANYWHERE Bill Yi
Auto-generated-cl: translation import Change-Id: Ie4d5d754a519097dcdfcd3815ab97fc1d5ba7346
2024-03-28Introduce ChooserRequestRepository Steve Elliott
- Replace TargetIntentRepository with ChooserRequestRepository, using the ChooserRequest as the source of truth for the target intent. - Caveat: custom actions are tracked separately to facilitate with testing; long-term we will want to update/replace ChooserRequest so that it isn't relying on un-mockable/un-fakeable types. - Remove concept of "initialization" from repositories. - Usages are better captured as "events", and so are handled in interactor codepaths that flow *into* the repositories. Bug: 302691505 Flag: ACONFIG android.service.chooser.chooser_payload_toggling DEVELOPMENT Test: atest IntentResolver-tests-unit Change-Id: I8451a495478dbe750a44e6b049d4751fa7badf81
2024-03-25Merge "Payload selection callback: explicitely encode absent property ↵ Treehugger Robot
values." into main
2024-03-25Apply ag/26029901 to V2 Matt Casey
Avoid NPE when checking if an adapter is empty. Bug: 328172905 Test: atest IntentResolver-tests-activity Change-Id: Id5f46cb876cf27c526f601bc8890d59533a1788f
2024-03-22Payload selection callback: explicitely encode absent property values. Andrey Epin
Add a sealed type to encode either a value or the absense of it in the payload selection change callback result. Bug: 302691505 Test: atest IntentResolver-tests-unit Test: manual functionaliryt test using ShareTest app Change-Id: I3b736df3fbf62b1841506f2c41324841d2a3d617
2024-03-21Import translations. DO NOT MERGE ANYWHERE Bill Yi
Auto-generated-cl: translation import Change-Id: Iacdcd2bf81b87af04b38069c4e68b0e51a6d4a44
2024-03-21Merge "Fix the target intent update overrides other chooser params" into main Andrey Yepin
2024-03-21Merge "Update modify share action on selection change update" into main Andrey Yepin
2024-03-21Merge "Reload app targets when alternate intents are updated" into main Treehugger Robot
2024-03-21Fix the target intent update overrides other chooser params Andrey Epin
Bug: 302691505 Test: atest IntentResolver-tests-unit Flags: ACONFIG android.service.chooser.chooser_payload_toggling DEVELOPMENT Change-Id: Id0cb886e68ccff5cf527cc7b3ef5c3c1fdd51c3c
2024-03-21Update modify share action on selection change update Andrey Epin
1. Trivial refactoring: move repetitive displayModifyShareAction call from each ConventPreviewUi#display implenentation into ChooserContentPreviewUi#displayContentPreview. 2. Trivial refactoring: add new dependency to ChooserContentPreviewUi for the modify share action factory but still use ChooserActionFactory to provide the action. 3. Use a new factory for the modify share action that alway reads the lates ChooserRequest values. Update the modify share action upon ChooserRequest changes. Bug: 302691505 Test: manual functionality test with the ShareTest app Flag: ACONFIG android.service.chooser.chooser_payload_toggling DEVELOPMENT Change-Id: I3ee55746387bc8ba413244b76aca374a361d696d
2024-03-21Reload app targets when alternate intents are updated Andrey Epin
Bug: 302691505 Test: manuate testing with the ShareTest app Change-Id: I061d9d73832f8778e47f2024ee3f25e2dae0c69e
2024-03-20Merge "Fix erroneous selection callback invocation." into main Treehugger Robot
2024-03-19Fix erroneous selection callback invocation. Andrey Epin
Setting the initial selection was treated as a selection change and caused the selection callback invocation. Fixed by making PreviewsSelectionRepository and TargetIntentRepository publishing annotated statuses that allow their clients to avoid performing unnecessary actions. Fix: 330000366 Test: atest IntentResolver-tests-unit Test: verified with an injected logging Change-Id: I1d8bee97ebf0ecaf9db98988a96af887ee0d9cd7
2024-03-15Remove caching from UserScopedService Mark Renouf
Caching the intermediate values isn't necessary and could present an opportunity for a memory leak. Retrieved service instances should be stored for as long as they are needed, and once out of scope, be available for collection. This aligns with the copy now in SystemUI: ag/26600464 Flag: None; no usages yet Test: NA; this class is stateless Bug: 327613051 Change-Id: I2b1225cad3d17baf1a7c45e6b5e8e9ca0a79df03
2024-03-14Correct all Kotlin formatting errors Mark Renouf
This is the result of applying ktfmt across all IntentResolver Kotlin files. Only a few minor issues are present, and the resulting format seems acceptable. Modifying any Kotlin file will trigger ktlint errors at upload time, forcing usage of '--no-verify' to avoid changing unrelated lines. This only leads to further formatting issues slipping in. By clearing all the existing formatting problems, new issues should only only be found in modified or inserted lines of existing files as well as added files. external/ktfmt/ktfmt.py pacakges/modules/IntentResolver Test: NA Bug: NA Change-Id: Ia8dfe1780b384a685df0d137a8de7c473e899a20
2024-03-14Readability clean up for UserRepository Mark Renouf
Use a sealed interface for events to eliminate unused properties. Extract the event branching from the flow statement. Improve logging and extract to a simple method. Bug: NA Test: atest IntentResolver-tests-unit Flag: NA Change-Id: I348558b3ca1506b7ece1c19295263e8824ac2575
2024-03-14Merge "Update remaining payload change callback values" into main Treehugger Robot
2024-03-14Update remaining payload change callback values Andrey Epin
Moves ShareouselUpdate out of SelectionChangeCallback into the model package. Receives result intent sender and metadata text from the callback. Propagate chooser requst changes from the callback to the ChooserViewModel; update result sender in ChooserActivity. Bug: 302691505 Test: IntentResolver-tests-unit Test: manual test with the updated CTS-V test Change-Id: I3b05cb35b94cb820c5f4fdc9fbc336dd072c36bd
2024-03-13Merge "Add UiEvent for shareousel payload toggle" into main Matt Casey
2024-03-13Merge "Add missing copyright headers." into main Mark Renouf
2024-03-13Merge "Remove unused Role.type from User" into main Mark Renouf
2024-03-12Merge "Update app targets on payload selection change" into main Treehugger Robot
2024-03-12Add missing copyright headers. mrenouf
Flag: NA Bug: NA Test: NA Change-Id: Ic19cf0a16f49e8664daca977610453ec74121a28
2024-03-12Update app targets on payload selection change Andrey Epin
ShareouselContentPreviewViewModel is merged into ChooserViewModel (to make all shareousel injectable available in ChooserViewModel without changing their scope). The shareousel machinery is initialized lazily to match the legacy behavior. PreviewSelectionRepository now publish selections only after the initial value has been read (vs. starting with the empty selection) to avoid triggering unnecessary targets resolution. A new interactor is added that updates ChooserRequest upon changes in the target request repository. Bug: 302691505 Test: manual functinality test with and without payload toggling flag Test: atest IntentResolver-tests-unit Test: atest IntentResolver-tests-activity Change-Id: I2f3d4f636e8ebe4a003e955cb5f089c28f2a7f1d
2024-03-12UserScopedService: Cache and share contexts mrenouf
This change caches both the Context and the Service instance to reuse both as needed. Previously a new Context is created for every service for a given user. In addition, switch to LruCache instead of a plain main, which provides an upper bound on the number of cached instances as a safeguard. Finally, switch the key to UserHandle to decouple from other sharesheet concepts. This mechanism is an implementation detail and not for general use so framework types are fine here. Bug: 324428064 Test: Not yet used Flag: Not yet used Change-Id: I0115853f0c8888d59ebb0407391a1e6d3c6e7e6c
2024-03-12Add JavaInterop @RequiresOptin to Java support classes mrenouf
Restrict usage to Java. Can be overridden by adding an @OpIn in Kotlin code if necessary. Bug: 309960444 Test: atest IntentResolver-tests-unit Flag: NA Change-Id: I6952aa295cc67deee5e372e20fd2bb3baa9cc056
2024-03-11Remove unused Role.type from User mrenouf
This removes a single assertion and a test covering it. Asserting on type can instead be done by just testing if the user is the profile parent. This will be modeled in the new design. Bug: 328927949 Test: atest IntentResolver-tests-unit Change-Id: I3a28d986f36f87190a4af5c98ed954999250fd92
2024-03-11Add UiEvent for shareousel payload toggle Matt Casey
Bug: 329068612 Test: Builds Change-Id: I616cccc60d550b6961526faa473d5fc4131d16b2
2024-03-11Replaces BundleUtil with AndroidX bundleOf mrenouf
Flag: NA Test: atest IntentResolver-tests-unit Bug: NA Change-Id: I0057955079ec164b4ff640a48aeb4dac3f1e6620
2024-03-09Merge "Remove final from framework methods" into main Treehugger Robot
2024-03-09Merge "Make 'ShortcutSelectionLogic' Injectable." into main Treehugger Robot
2024-03-08Remove final from framework methods Mark Renouf
Hilt generates a base class and somehow inherits the final modifier in the process, causes compilation to fail when final methods are overridden in the generated class hierarchy. There errors from dagger generated classes were: error: onCreate(Bundle) in ChooserActivity cannot override onCreate(Bundle) in Hilt_ChooserActivity overridden method is final error: onDestroy() in ChooserActivity cannot override onDestroy() in Hilt_ChooserActivity overridden method is final error: onCreate(Bundle) in ResolverActivity cannot override onCreate(Bundle) in Hilt_ResolverActivity protected final void onCreate(Bundle savedInstanceState) { Flag: NA Test: atest IntentResolver-tests-activity:com.android.intentresolver.v2 Bug: NA Change-Id: Id925938ab9ce48caaa451a943547f1912058cfdf
2024-03-08Merge "Shareousel ui layer" into main Treehugger Robot
2024-03-08Merge "PayloadToggle domain layer selection tracking" into main Treehugger Robot
2024-03-08Shareousel ui layer Steve Elliott
Bug: 302691505 Flag: ACONFIG android.service.chooser.chooser_payload_toggling DEVELOPMENT Test: atest IntentResolver-tests-unit Change-Id: Ia292f2274c94259b173aa09d187840f03921dfc5
2024-03-08PayloadToggle domain layer selection tracking Steve Elliott
Bug: 302691505 Flag: ACONFIG android.service.chooser.chooser_payload_toggling DEVELOPMENT Test: atest IntentResolver-tests-unit Change-Id: Ibb3c242abc90048304dc4c57b18a3102a0fd8fed
2024-03-08Merge "Change the cutout mode of ChooserWrapperActivity" into main Tiger Huang
2024-03-07PayloadToggle domain layer preview data population Steve Elliott
This change introduces the logic by which Shareousel is initialized with previews, as well as how additional previews can be loaded if requested by the UI. Initially, previews are taken from the EXTRA_STREAM contents of the sharing intent. Simultaneously, a connection to the sharing-application's cursor is established and then queried; the initial data loaded from the cursor then replaces the initial content. When the UI requests, additional data from the cursor is loaded into memory; the loaded data is always contiguous, and so requests can only be made to load the data immediately before or after whatever is already loaded. Once an end of the cursor has been reached (either first or last row), any elements in the intitial selection set (EXTRA_STREAM) that have not yet appeared in the Cursor are appended, *if* those elements would have appeared in that direction relative to the "focused index" of the set. In order to limit memory usage, we limit the amount of data cached in memory from the Cursor; as additional data is loaded in one direction, data from the other direction can be evicted from the cache. Bug: 302691505 Flag: ACONFIG android.service.chooser.chooser_payload_toggling DEVELOPMENT Test: atest IntentResolver-tests-unit Change-Id: I0ba7bffc10b4369d55a14aec626ca2c22f95dbb7
2024-03-07Introduce payloadtoggle data layer Steve Elliott
Bug: 302691505 Flag: ACONFIG android.service.chooser.chooser_payload_toggling DEVELOPMENT Test: N/A - code isn't live Change-Id: I5f96b97919db21f3705add6d67fd97ae267c09e2
2024-03-06ChooserActivity Profile integration [2/2] Mark Renouf
* updates 'MultiProfilePagerAdapter' creation * create tab config list from available profiles * replace MPPA profile constants with Profile.Type.ordinal * replace Tab tags with Profile.Type.name() Bug: 311348033 Test: atest IntentResolver-tests-activity:com.android.intentresolver.v2 Test: atest IntentResolver-tests-unit Change-Id: Id874721eef89661a5c2dbeb795c2096da544deca
2024-03-06ChooserActivity Profile integration [1/2] mrenouf
* connects ChooserActivity with UserInteractor * replaces all existing references as the source of UserHandles * app continues to explicity use the same profile types as previous * updates Activity tests to use FakeUserRepository A following change will modify initialization to incorporate build the UI based on the list of profiles, instead of explicit references to individual profile types. Bug: 300157408 Bug: 311348033 Test: atest IntentResolver-tests-activity:com.android.intentresolver.v2 Change-Id: I6043e57fd7a8aff8c252e2b12171d457612d35dc
2024-03-06Change the cutout mode of ChooserWrapperActivity Tiger
This CL changes the mode from shortEdge to always. Bug: 309578419 Bug: 327607282 Test: atest UnbundledChooserActivityTest Change-Id: I5df32f9b067e5b3f6574e444f33921deb4cf3713
2024-03-06Merge "ChooserActivity: return missing ResolverActivity onDestroy logic" ↵ Mark Renouf
into main
2024-03-06ChooserActivity: return missing ResolverActivity onDestroy logic Andrey Epin
A destroy method is added to ChooserMultiProfilePagerAdapter that calls destroy on every page's list adapter; ChooserActivity uses this method instead of the legacy code that called destroy only on the active page's list adapter. A weak reference is added between Binder callbacks to limit retained lifetime of remotely referenced objects. Fix: 328084479 Test: manual functionality testing Test: launch Chooser multiple times, collect a process heap dump forcing garbage collection, check the heap dump and verify that no ChooserActivity remains in memory. Change-Id: Ie6e51ed447c6a609a890edaf97aa19f8ad824238
2024-03-05Create a Resolver-specific NoCrossProfileEmptyStateprovider Mark Renouf
This is a temporary measure to split upcoming CLs between actively shipping code and future work (ResolverActivity). This allows correcting the rules to work with private profile, while deferring changes to ResolverActivity which will follow soon. After ResolverActivity is updated, this copy can be removed. Bug: 328029692 Test: atest IntentResolver-tests-activity Test: atest IntentResolver-tests-unit Change-Id: I48ba6e3d1c575feec838ac829753158134c9023b
2024-03-05Set shareousel background color Steve Elliott
Bug: 302691505 Flag: ACONFIG android.service.chooser.chooser_payload_toggling DEVELOPMENT Test: N/A - code isn't live Change-Id: Iba603fa63fdecc5b927d80f7d4bd3bae2b65201c
2024-03-04Merge "Make ImageLoader injectable" into main Andrey Yepin
2024-03-03Create ActivityModel directly instead of injecting mrenouf
There is an initialization order issue with the existing approach: Within the Hilt framework, the ViewModelComponent is initialized prior to injecting the Activity. The ViewModel cannot then depend on any injected values since they will not be available when required. Due to another bug, this was not causing a problem because the value of the injected field was never being checked when the ViewModel was requested in onCreate. The value was inserted on the second request for the ViewModel, after onCreate, and this would mutate the state of the default args Bundle in the already created instance's SavedStateHandle. (Fixed in ag/26434053) The @ActivityScoped Module providing the ActivityModel is replaced with a simple method which creates an instaance from the Activity. The ActivityModel is then available from the ViewModel. This method exists to allows for changing the launchedFromUid, launchedFromPackage, and referrer values without dependence on the system. Bug: 300157408 Test: atest IntentResolver-tests-activity:com.android.intentresolver.v2 Change-Id: I297cbd602c13462f0c0614a279655f2852658dc4
2024-03-03Fix CreationExtras.addDefaultArgs when args absent mrenouf
addDefaultArgs grabs the existing Bundle from CreationExtras and adds in the additional values. If default args aren't present (whenever the initial intent did not have extras), the updated bundle was never returned within the original instance since it was relying on modifying the Bundle in-place. This corrects the issue by explicitly returning a new instance containing the updated `DEFAULT_ARGS` Bundle. Test: atest com.android.intentresolver.v2.ext.CreationExtrasExtTest Change-Id: I5a7c61baaaeefa2878b4041d809c348bf5ac70c0