Loading core/java/android/app/ActivityThread.java +41 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,8 @@ import android.view.Window; import android.view.WindowManager; import android.view.WindowManagerGlobal; import android.view.autofill.AutofillId; import android.view.contentcapture.IContentCaptureManager; import android.view.contentcapture.IContentCaptureOptionsCallback; import android.view.translation.TranslationSpec; import android.webkit.WebView; import android.window.SplashScreen; Loading Loading @@ -512,6 +514,8 @@ public final class ActivityThread extends ClientTransactionHandler { boolean mHasImeComponent = false; private IContentCaptureOptionsCallback.Stub mContentCaptureOptionsCallback = null; /** Activity client record, used for bookkeeping for the real {@link Activity} instance. */ public static final class ActivityClientRecord { @UnsupportedAppUsage Loading Loading @@ -1939,6 +1943,7 @@ public final class ActivityThread extends ClientTransactionHandler { public static final int PURGE_RESOURCES = 161; public static final int ATTACH_STARTUP_AGENTS = 162; public static final int UPDATE_UI_TRANSLATION_STATE = 163; public static final int SET_CONTENT_CAPTURE_OPTIONS_CALLBACK = 164; public static final int INSTRUMENT_WITHOUT_RESTART = 170; public static final int FINISH_INSTRUMENTATION_WITHOUT_RESTART = 171; Loading Loading @@ -1988,6 +1993,8 @@ public final class ActivityThread extends ClientTransactionHandler { case PURGE_RESOURCES: return "PURGE_RESOURCES"; case ATTACH_STARTUP_AGENTS: return "ATTACH_STARTUP_AGENTS"; case UPDATE_UI_TRANSLATION_STATE: return "UPDATE_UI_TRANSLATION_STATE"; case SET_CONTENT_CAPTURE_OPTIONS_CALLBACK: return "SET_CONTENT_CAPTURE_OPTIONS_CALLBACK"; case INSTRUMENT_WITHOUT_RESTART: return "INSTRUMENT_WITHOUT_RESTART"; case FINISH_INSTRUMENTATION_WITHOUT_RESTART: return "FINISH_INSTRUMENTATION_WITHOUT_RESTART"; Loading Loading @@ -2180,6 +2187,9 @@ public final class ActivityThread extends ClientTransactionHandler { (TranslationSpec) args.arg3, (TranslationSpec) args.arg4, (List<AutofillId>) args.arg5); break; case SET_CONTENT_CAPTURE_OPTIONS_CALLBACK: handleSetContentCaptureOptionsCallback((String) msg.obj); break; case INSTRUMENT_WITHOUT_RESTART: handleInstrumentWithoutRestart((AppBindData) msg.obj); break; Loading Loading @@ -6795,6 +6805,7 @@ public final class ActivityThread extends ClientTransactionHandler { // Propagate Content Capture options app.setContentCaptureOptions(data.contentCaptureOptions); sendMessage(H.SET_CONTENT_CAPTURE_OPTIONS_CALLBACK, data.appInfo.packageName); mInitialApplication = app; Loading Loading @@ -6856,6 +6867,36 @@ public final class ActivityThread extends ClientTransactionHandler { } } private void handleSetContentCaptureOptionsCallback(String packageName) { if (mContentCaptureOptionsCallback != null) { return; } IBinder b = ServiceManager.getService(Context.CONTENT_CAPTURE_MANAGER_SERVICE); if (b == null) { return; } IContentCaptureManager service = IContentCaptureManager.Stub.asInterface(b); mContentCaptureOptionsCallback = new IContentCaptureOptionsCallback.Stub() { @Override public void setContentCaptureOptions(ContentCaptureOptions options) throws RemoteException { if (mInitialApplication != null) { mInitialApplication.setContentCaptureOptions(options); } } }; try { service.registerContentCaptureOptionsCallback(packageName, mContentCaptureOptionsCallback); } catch (RemoteException e) { Slog.w(TAG, "registerContentCaptureOptionsCallback() failed: " + packageName, e); mContentCaptureOptionsCallback = null; } } private void handleInstrumentWithoutRestart(AppBindData data) { try { data.compatInfo = CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO; Loading core/java/android/view/contentcapture/IContentCaptureManager.aidl +7 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.view.contentcapture.ContentCaptureEvent; import android.view.contentcapture.DataRemovalRequest; import android.view.contentcapture.DataShareRequest; import android.view.contentcapture.IDataShareWriteAdapter; import android.view.contentcapture.IContentCaptureOptionsCallback; import android.os.IBinder; import android.os.ICancellationSignal; Loading Loading @@ -101,4 +102,10 @@ oneway interface IContentCaptureManager { * Sets whether the default service should be used. */ void setDefaultServiceEnabled(int userId, boolean enabled); /** * Registers a listener to handle updates ContentCaptureOptions from server. */ void registerContentCaptureOptionsCallback(String packageName, in IContentCaptureOptionsCallback callback); } core/java/android/view/contentcapture/IContentCaptureOptionsCallback.aidl 0 → 100644 +31 −0 Original line number Diff line number Diff line /** * Copyright (c) 2021, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.view.contentcapture; import android.content.ContentCaptureOptions; /** * Callback for changes to content capture options made by ContentCaptureService. * Callback interface used by IContentCaptureManager to send asynchronous * notifications back to its clients. Note that this is a * one-way interface so the server does not block waiting for the client. * * @hide */ oneway interface IContentCaptureOptionsCallback { void setContentCaptureOptions(in ContentCaptureOptions options); } core/java/com/android/internal/infra/GlobalWhitelistState.java +12 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,18 @@ public class GlobalWhitelistState { } } /** * Gets packages that are either entirely allowlisted or have components that are allowlisted * for the given user. */ public ArraySet<String> getWhitelistedPackages(@UserIdInt int userId) { synchronized (mGlobalWhitelistStateLock) { if (mWhitelisterHelpers == null) return null; final WhitelistHelper helper = mWhitelisterHelpers.get(userId); return helper == null ? null : helper.getWhitelistedPackages(); } } /** * Resets the allowlist for the given user. */ Loading core/java/com/android/internal/infra/WhitelistHelper.java +9 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,15 @@ public final class WhitelistHelper { return mWhitelistedPackages == null ? null : mWhitelistedPackages.get(packageName); } /** * Returns a set of all packages that are either entirely allowlisted or have components that * are allowlisted. */ @Nullable public ArraySet<String> getWhitelistedPackages() { return mWhitelistedPackages == null ? null : new ArraySet<>(mWhitelistedPackages.keySet()); } @Override public String toString() { return "WhitelistHelper[" + mWhitelistedPackages + ']'; Loading Loading
core/java/android/app/ActivityThread.java +41 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,8 @@ import android.view.Window; import android.view.WindowManager; import android.view.WindowManagerGlobal; import android.view.autofill.AutofillId; import android.view.contentcapture.IContentCaptureManager; import android.view.contentcapture.IContentCaptureOptionsCallback; import android.view.translation.TranslationSpec; import android.webkit.WebView; import android.window.SplashScreen; Loading Loading @@ -512,6 +514,8 @@ public final class ActivityThread extends ClientTransactionHandler { boolean mHasImeComponent = false; private IContentCaptureOptionsCallback.Stub mContentCaptureOptionsCallback = null; /** Activity client record, used for bookkeeping for the real {@link Activity} instance. */ public static final class ActivityClientRecord { @UnsupportedAppUsage Loading Loading @@ -1939,6 +1943,7 @@ public final class ActivityThread extends ClientTransactionHandler { public static final int PURGE_RESOURCES = 161; public static final int ATTACH_STARTUP_AGENTS = 162; public static final int UPDATE_UI_TRANSLATION_STATE = 163; public static final int SET_CONTENT_CAPTURE_OPTIONS_CALLBACK = 164; public static final int INSTRUMENT_WITHOUT_RESTART = 170; public static final int FINISH_INSTRUMENTATION_WITHOUT_RESTART = 171; Loading Loading @@ -1988,6 +1993,8 @@ public final class ActivityThread extends ClientTransactionHandler { case PURGE_RESOURCES: return "PURGE_RESOURCES"; case ATTACH_STARTUP_AGENTS: return "ATTACH_STARTUP_AGENTS"; case UPDATE_UI_TRANSLATION_STATE: return "UPDATE_UI_TRANSLATION_STATE"; case SET_CONTENT_CAPTURE_OPTIONS_CALLBACK: return "SET_CONTENT_CAPTURE_OPTIONS_CALLBACK"; case INSTRUMENT_WITHOUT_RESTART: return "INSTRUMENT_WITHOUT_RESTART"; case FINISH_INSTRUMENTATION_WITHOUT_RESTART: return "FINISH_INSTRUMENTATION_WITHOUT_RESTART"; Loading Loading @@ -2180,6 +2187,9 @@ public final class ActivityThread extends ClientTransactionHandler { (TranslationSpec) args.arg3, (TranslationSpec) args.arg4, (List<AutofillId>) args.arg5); break; case SET_CONTENT_CAPTURE_OPTIONS_CALLBACK: handleSetContentCaptureOptionsCallback((String) msg.obj); break; case INSTRUMENT_WITHOUT_RESTART: handleInstrumentWithoutRestart((AppBindData) msg.obj); break; Loading Loading @@ -6795,6 +6805,7 @@ public final class ActivityThread extends ClientTransactionHandler { // Propagate Content Capture options app.setContentCaptureOptions(data.contentCaptureOptions); sendMessage(H.SET_CONTENT_CAPTURE_OPTIONS_CALLBACK, data.appInfo.packageName); mInitialApplication = app; Loading Loading @@ -6856,6 +6867,36 @@ public final class ActivityThread extends ClientTransactionHandler { } } private void handleSetContentCaptureOptionsCallback(String packageName) { if (mContentCaptureOptionsCallback != null) { return; } IBinder b = ServiceManager.getService(Context.CONTENT_CAPTURE_MANAGER_SERVICE); if (b == null) { return; } IContentCaptureManager service = IContentCaptureManager.Stub.asInterface(b); mContentCaptureOptionsCallback = new IContentCaptureOptionsCallback.Stub() { @Override public void setContentCaptureOptions(ContentCaptureOptions options) throws RemoteException { if (mInitialApplication != null) { mInitialApplication.setContentCaptureOptions(options); } } }; try { service.registerContentCaptureOptionsCallback(packageName, mContentCaptureOptionsCallback); } catch (RemoteException e) { Slog.w(TAG, "registerContentCaptureOptionsCallback() failed: " + packageName, e); mContentCaptureOptionsCallback = null; } } private void handleInstrumentWithoutRestart(AppBindData data) { try { data.compatInfo = CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO; Loading
core/java/android/view/contentcapture/IContentCaptureManager.aidl +7 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.view.contentcapture.ContentCaptureEvent; import android.view.contentcapture.DataRemovalRequest; import android.view.contentcapture.DataShareRequest; import android.view.contentcapture.IDataShareWriteAdapter; import android.view.contentcapture.IContentCaptureOptionsCallback; import android.os.IBinder; import android.os.ICancellationSignal; Loading Loading @@ -101,4 +102,10 @@ oneway interface IContentCaptureManager { * Sets whether the default service should be used. */ void setDefaultServiceEnabled(int userId, boolean enabled); /** * Registers a listener to handle updates ContentCaptureOptions from server. */ void registerContentCaptureOptionsCallback(String packageName, in IContentCaptureOptionsCallback callback); }
core/java/android/view/contentcapture/IContentCaptureOptionsCallback.aidl 0 → 100644 +31 −0 Original line number Diff line number Diff line /** * Copyright (c) 2021, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.view.contentcapture; import android.content.ContentCaptureOptions; /** * Callback for changes to content capture options made by ContentCaptureService. * Callback interface used by IContentCaptureManager to send asynchronous * notifications back to its clients. Note that this is a * one-way interface so the server does not block waiting for the client. * * @hide */ oneway interface IContentCaptureOptionsCallback { void setContentCaptureOptions(in ContentCaptureOptions options); }
core/java/com/android/internal/infra/GlobalWhitelistState.java +12 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,18 @@ public class GlobalWhitelistState { } } /** * Gets packages that are either entirely allowlisted or have components that are allowlisted * for the given user. */ public ArraySet<String> getWhitelistedPackages(@UserIdInt int userId) { synchronized (mGlobalWhitelistStateLock) { if (mWhitelisterHelpers == null) return null; final WhitelistHelper helper = mWhitelisterHelpers.get(userId); return helper == null ? null : helper.getWhitelistedPackages(); } } /** * Resets the allowlist for the given user. */ Loading
core/java/com/android/internal/infra/WhitelistHelper.java +9 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,15 @@ public final class WhitelistHelper { return mWhitelistedPackages == null ? null : mWhitelistedPackages.get(packageName); } /** * Returns a set of all packages that are either entirely allowlisted or have components that * are allowlisted. */ @Nullable public ArraySet<String> getWhitelistedPackages() { return mWhitelistedPackages == null ? null : new ArraySet<>(mWhitelistedPackages.keySet()); } @Override public String toString() { return "WhitelistHelper[" + mWhitelistedPackages + ']'; Loading