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

Commit 5a0b568b authored by Rambo Wang's avatar Rambo Wang Committed by rambowang
Browse files

Remove redundant content in javadoc of new introduced API

This change removes the implementation suggestion for the javadoc of API ACTION_SYSTEM_UPDATE_SETTINGS. Javadoc of an API should be client-oriented, not implementation-oriented.

The implementation suggestion is enforced by introducing new CTS test cases to avoid security issue.

Bug: 417458670
Fix: 423988266
Test: atest android.provider.cts.settings.SettingsTest
Flag: android.provider.expose_system_update_settings
Change-Id: Icf63d9f36b2ffe203429e1c8a4aa02f58b49ca21
parent 8834fee9
Loading
Loading
Loading
Loading
+15 −12
Original line number Diff line number Diff line
@@ -1729,21 +1729,24 @@ public final class Settings {
     * In some cases, a matching Activity may not exist, so ensure you
     * safeguard against this.
     * <p>
     * This intent is designed to be handled by a system component. To securely launch this intent,
     * resolve the intent to a system application and verify that its priority is higher than the
     * default value (0). This prevents other apps from intercepting the intent. If multiple system
     * applications can handle this intent, the component with the highest priority will be
     * launched.
     * <p>
     * For example:
     * <pre>
     * final PackageManager pm = context.getPackageManager();
     * final Intent intent = new Intent(Settings.ACTION_SYSTEM_UPDATE_SETTINGS);
     * final List&lt;ResolveInfo&gt; resolveInfos =
     *         pm.queryIntentActivities(intent, PackageManager.MATCH_SYSTEM_ONLY);
     * // ... find the ResolveInfo with the highest priority, ensure it's > 0, and launch it.
     * </pre>
     * <p>
     * Input: Nothing.
     * <p>
     * Output: Nothing.
     *
     * <p>To prevent interception by third-party applications, system settings apps should implement
     * the system update functionality that must set a priority higher than default value (0).
     * Example:
     *
     * <pre>{@code
     * <Activity android:name=".MySystemUpdate">
     *     <intent-filter android:priority="1">
     *         <action android:name="android.settings.SYSTEM_UPDATE_SETTINGS" />
     *     </intent-filter>
     * </Activity>
     * }</pre>
     */
    @FlaggedApi(Flags.FLAG_EXPOSE_SYSTEM_UPDATE_SETTINGS)
    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)