Loading core/java/android/provider/Settings.java +10 −0 Original line number Diff line number Diff line Loading @@ -12704,6 +12704,16 @@ public final class Settings { * @hide */ public static final String CHARGE_OPTIMIZATION_MODE = "charge_optimization_mode"; /** * String property which contains the package name of the contextual * search provider supplied by individual OEM's * R.string.config_defaultContextualSearchPackageName. * * @hide */ @Readable public static final String CONTEXTUAL_SEARCH_PACKAGE = "contextual_search_package"; } /** Loading packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -679,6 +679,7 @@ public class SettingsBackupTest { Settings.Secure.COMPLETED_CATEGORY_PREFIX, Settings.Secure.CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS, Settings.Secure.CONTENT_CAPTURE_ENABLED, Settings.Secure.CONTEXTUAL_SEARCH_PACKAGE, Settings.Secure.DEFAULT_INPUT_METHOD, Settings.Secure.DEFAULT_DEVICE_INPUT_METHOD, Settings.Secure.DEVICE_PAIRED, Loading services/contextualsearch/java/com/android/server/contextualsearch/ContextualSearchManagerService.java +22 −2 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ import android.os.ResultReceiver; import android.os.ServiceManager; import android.os.ShellCallback; import android.os.SystemClock; import android.provider.Settings; import android.util.Log; import android.util.Slog; import android.view.IWindowManager; Loading Loading @@ -168,6 +169,8 @@ public class ContextualSearchManagerService extends SystemService { IWindowManager.Stub.asInterface(ServiceManager.getService(Context.WINDOW_SERVICE)), mContext.getSystemService(AppOpsManager.class), mAssistDataCallbacks, mLock, OP_ASSIST_STRUCTURE, OP_ASSIST_SCREENSHOT); updateSecureSetting(); } @Override Loading @@ -175,6 +178,22 @@ public class ContextualSearchManagerService extends SystemService { publishBinderService(CONTEXTUAL_SEARCH_SERVICE, new ContextualSearchManagerStub()); } private void updateSecureSetting() { // Write default package to secure setting every time there is a change. If OEM didn't // supply a new value in their config, then we would write empty string. Settings.Secure.putString( mContext.getContentResolver(), Settings.Secure.CONTEXTUAL_SEARCH_PACKAGE, getContextualSearchPackageName()); } private String getContextualSearchPackageName() { synchronized (this) { return mTemporaryPackage != null ? mTemporaryPackage : mContext .getResources().getString(R.string.config_defaultContextualSearchPackageName); } } void resetTemporaryPackage() { synchronized (this) { enforceOverridingPermission("resetTemporaryPackage"); Loading @@ -184,6 +203,7 @@ public class ContextualSearchManagerService extends SystemService { } if (DEBUG_USER) Log.d(TAG, "mTemporaryPackage reset."); mTemporaryPackage = null; updateSecureSetting(); } } Loading Loading @@ -212,6 +232,7 @@ public class ContextualSearchManagerService extends SystemService { mTemporaryHandler.removeMessages(MSG_RESET_TEMPORARY_PACKAGE); } mTemporaryPackage = temporaryPackage; updateSecureSetting(); mTemporaryHandler.sendEmptyMessageDelayed(MSG_RESET_TEMPORARY_PACKAGE, durationMs); if (DEBUG_USER) Log.d(TAG, "mTemporaryPackage set to " + mTemporaryPackage); } Loading Loading @@ -243,8 +264,7 @@ public class ContextualSearchManagerService extends SystemService { private Intent getResolvedLaunchIntent() { synchronized (this) { // If mTemporaryPackage is not null, use it to get the ContextualSearch intent. String csPkgName = mTemporaryPackage != null ? mTemporaryPackage : mContext .getResources().getString(R.string.config_defaultContextualSearchPackageName); String csPkgName = getContextualSearchPackageName(); if (csPkgName.isEmpty()) { // Return null if csPackageName is not specified. return null; Loading Loading
core/java/android/provider/Settings.java +10 −0 Original line number Diff line number Diff line Loading @@ -12704,6 +12704,16 @@ public final class Settings { * @hide */ public static final String CHARGE_OPTIMIZATION_MODE = "charge_optimization_mode"; /** * String property which contains the package name of the contextual * search provider supplied by individual OEM's * R.string.config_defaultContextualSearchPackageName. * * @hide */ @Readable public static final String CONTEXTUAL_SEARCH_PACKAGE = "contextual_search_package"; } /** Loading
packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -679,6 +679,7 @@ public class SettingsBackupTest { Settings.Secure.COMPLETED_CATEGORY_PREFIX, Settings.Secure.CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS, Settings.Secure.CONTENT_CAPTURE_ENABLED, Settings.Secure.CONTEXTUAL_SEARCH_PACKAGE, Settings.Secure.DEFAULT_INPUT_METHOD, Settings.Secure.DEFAULT_DEVICE_INPUT_METHOD, Settings.Secure.DEVICE_PAIRED, Loading
services/contextualsearch/java/com/android/server/contextualsearch/ContextualSearchManagerService.java +22 −2 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ import android.os.ResultReceiver; import android.os.ServiceManager; import android.os.ShellCallback; import android.os.SystemClock; import android.provider.Settings; import android.util.Log; import android.util.Slog; import android.view.IWindowManager; Loading Loading @@ -168,6 +169,8 @@ public class ContextualSearchManagerService extends SystemService { IWindowManager.Stub.asInterface(ServiceManager.getService(Context.WINDOW_SERVICE)), mContext.getSystemService(AppOpsManager.class), mAssistDataCallbacks, mLock, OP_ASSIST_STRUCTURE, OP_ASSIST_SCREENSHOT); updateSecureSetting(); } @Override Loading @@ -175,6 +178,22 @@ public class ContextualSearchManagerService extends SystemService { publishBinderService(CONTEXTUAL_SEARCH_SERVICE, new ContextualSearchManagerStub()); } private void updateSecureSetting() { // Write default package to secure setting every time there is a change. If OEM didn't // supply a new value in their config, then we would write empty string. Settings.Secure.putString( mContext.getContentResolver(), Settings.Secure.CONTEXTUAL_SEARCH_PACKAGE, getContextualSearchPackageName()); } private String getContextualSearchPackageName() { synchronized (this) { return mTemporaryPackage != null ? mTemporaryPackage : mContext .getResources().getString(R.string.config_defaultContextualSearchPackageName); } } void resetTemporaryPackage() { synchronized (this) { enforceOverridingPermission("resetTemporaryPackage"); Loading @@ -184,6 +203,7 @@ public class ContextualSearchManagerService extends SystemService { } if (DEBUG_USER) Log.d(TAG, "mTemporaryPackage reset."); mTemporaryPackage = null; updateSecureSetting(); } } Loading Loading @@ -212,6 +232,7 @@ public class ContextualSearchManagerService extends SystemService { mTemporaryHandler.removeMessages(MSG_RESET_TEMPORARY_PACKAGE); } mTemporaryPackage = temporaryPackage; updateSecureSetting(); mTemporaryHandler.sendEmptyMessageDelayed(MSG_RESET_TEMPORARY_PACKAGE, durationMs); if (DEBUG_USER) Log.d(TAG, "mTemporaryPackage set to " + mTemporaryPackage); } Loading Loading @@ -243,8 +264,7 @@ public class ContextualSearchManagerService extends SystemService { private Intent getResolvedLaunchIntent() { synchronized (this) { // If mTemporaryPackage is not null, use it to get the ContextualSearch intent. String csPkgName = mTemporaryPackage != null ? mTemporaryPackage : mContext .getResources().getString(R.string.config_defaultContextualSearchPackageName); String csPkgName = getContextualSearchPackageName(); if (csPkgName.isEmpty()) { // Return null if csPackageName is not specified. return null; Loading