Loading core/java/android/app/SystemServiceRegistry.java +4 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.app.admin.IDevicePolicyManager; import android.app.ambientcontext.AmbientContextManager; import android.app.ambientcontext.IAmbientContextManager; import android.app.appfunctions.AppFunctionManager; import android.app.appfunctions.AppFunctionManagerConfiguration; import android.app.appfunctions.IAppFunctionManager; import android.app.appsearch.AppSearchManagerFrameworkInitializer; import android.app.blob.BlobStoreManagerFrameworkInitializer; Loading Loading @@ -937,8 +938,10 @@ public final class SystemServiceRegistry { @Override public AppFunctionManager createService(ContextImpl ctx) throws ServiceNotFoundException { if (!AppFunctionManagerConfiguration.isSupported(ctx)) { return null; } IAppFunctionManager service; //TODO(b/357551503): If the feature not present avoid look up every time service = IAppFunctionManager.Stub.asInterface( ServiceManager.getServiceOrThrow(Context.APP_FUNCTION_SERVICE)); return new AppFunctionManager(service, ctx.getOuterContext()); Loading core/java/android/app/appfunctions/AppFunctionManagerConfiguration.java 0 → 100644 +63 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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.app.appfunctions; import static android.app.appfunctions.flags.Flags.enableAppFunctionManager; import android.annotation.NonNull; import android.content.Context; import android.content.pm.PackageManager; /** * Represents the system configuration of support for the {@code AppFunctionManager} and * associated systems. * * @hide */ public class AppFunctionManagerConfiguration { private final Context mContext; /** * Constructs a new instance of {@code AppFunctionManagerConfiguration}. * @param context context */ public AppFunctionManagerConfiguration(@NonNull final Context context) { mContext = context; } /** * Indicates whether the current target is intended to support {@code AppFunctionManager}. * @return {@code true} if supported; otherwise {@code false} */ public boolean isSupported() { return enableAppFunctionManager() && !isWatch(); } /** * Indicates whether the current target is intended to support {@code AppFunctionManager}. * @param context context * @return {@code true} if supported; otherwise {@code false} */ public static boolean isSupported(@NonNull final Context context) { return new AppFunctionManagerConfiguration(context).isSupported(); } private boolean isWatch() { return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH); } } services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerService.java +2 −3 Original line number Diff line number Diff line Loading @@ -16,8 +16,7 @@ package com.android.server.appfunctions; import static android.app.appfunctions.flags.Flags.enableAppFunctionManager; import android.app.appfunctions.AppFunctionManagerConfiguration; import android.content.Context; import com.android.server.SystemService; Loading @@ -35,7 +34,7 @@ public class AppFunctionManagerService extends SystemService { @Override public void onStart() { if (enableAppFunctionManager()) { if (AppFunctionManagerConfiguration.isSupported(getContext())) { publishBinderService(Context.APP_FUNCTION_SERVICE, mServiceImpl); } } Loading services/java/com/android/server/SystemServer.java +4 −5 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.server; import static android.app.appfunctions.flags.Flags.enableAppFunctionManager; import static android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK; import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_CRITICAL; import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_HIGH; Loading @@ -38,6 +37,7 @@ import android.app.ApplicationErrorReport; import android.app.INotificationManager; import android.app.SystemServiceRegistry; import android.app.admin.DevicePolicySafetyChecker; import android.app.appfunctions.AppFunctionManagerConfiguration; import android.app.usage.UsageStatsManagerInternal; import android.content.ComponentName; import android.content.ContentResolver; Loading Loading @@ -1743,12 +1743,11 @@ public final class SystemServer implements Dumpable { mSystemServiceManager.startService(LogcatManagerService.class); t.traceEnd(); if (AppFunctionManagerConfiguration.isSupported(context)) { t.traceBegin("StartAppFunctionManager"); if (enableAppFunctionManager()) { mSystemServiceManager.startService(AppFunctionManagerService.class); } t.traceEnd(); } } catch (Throwable e) { Slog.e("System", "******************************************"); Slog.e("System", "************ Failure starting core service"); Loading Loading
core/java/android/app/SystemServiceRegistry.java +4 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.app.admin.IDevicePolicyManager; import android.app.ambientcontext.AmbientContextManager; import android.app.ambientcontext.IAmbientContextManager; import android.app.appfunctions.AppFunctionManager; import android.app.appfunctions.AppFunctionManagerConfiguration; import android.app.appfunctions.IAppFunctionManager; import android.app.appsearch.AppSearchManagerFrameworkInitializer; import android.app.blob.BlobStoreManagerFrameworkInitializer; Loading Loading @@ -937,8 +938,10 @@ public final class SystemServiceRegistry { @Override public AppFunctionManager createService(ContextImpl ctx) throws ServiceNotFoundException { if (!AppFunctionManagerConfiguration.isSupported(ctx)) { return null; } IAppFunctionManager service; //TODO(b/357551503): If the feature not present avoid look up every time service = IAppFunctionManager.Stub.asInterface( ServiceManager.getServiceOrThrow(Context.APP_FUNCTION_SERVICE)); return new AppFunctionManager(service, ctx.getOuterContext()); Loading
core/java/android/app/appfunctions/AppFunctionManagerConfiguration.java 0 → 100644 +63 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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.app.appfunctions; import static android.app.appfunctions.flags.Flags.enableAppFunctionManager; import android.annotation.NonNull; import android.content.Context; import android.content.pm.PackageManager; /** * Represents the system configuration of support for the {@code AppFunctionManager} and * associated systems. * * @hide */ public class AppFunctionManagerConfiguration { private final Context mContext; /** * Constructs a new instance of {@code AppFunctionManagerConfiguration}. * @param context context */ public AppFunctionManagerConfiguration(@NonNull final Context context) { mContext = context; } /** * Indicates whether the current target is intended to support {@code AppFunctionManager}. * @return {@code true} if supported; otherwise {@code false} */ public boolean isSupported() { return enableAppFunctionManager() && !isWatch(); } /** * Indicates whether the current target is intended to support {@code AppFunctionManager}. * @param context context * @return {@code true} if supported; otherwise {@code false} */ public static boolean isSupported(@NonNull final Context context) { return new AppFunctionManagerConfiguration(context).isSupported(); } private boolean isWatch() { return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH); } }
services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerService.java +2 −3 Original line number Diff line number Diff line Loading @@ -16,8 +16,7 @@ package com.android.server.appfunctions; import static android.app.appfunctions.flags.Flags.enableAppFunctionManager; import android.app.appfunctions.AppFunctionManagerConfiguration; import android.content.Context; import com.android.server.SystemService; Loading @@ -35,7 +34,7 @@ public class AppFunctionManagerService extends SystemService { @Override public void onStart() { if (enableAppFunctionManager()) { if (AppFunctionManagerConfiguration.isSupported(getContext())) { publishBinderService(Context.APP_FUNCTION_SERVICE, mServiceImpl); } } Loading
services/java/com/android/server/SystemServer.java +4 −5 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.server; import static android.app.appfunctions.flags.Flags.enableAppFunctionManager; import static android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK; import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_CRITICAL; import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_HIGH; Loading @@ -38,6 +37,7 @@ import android.app.ApplicationErrorReport; import android.app.INotificationManager; import android.app.SystemServiceRegistry; import android.app.admin.DevicePolicySafetyChecker; import android.app.appfunctions.AppFunctionManagerConfiguration; import android.app.usage.UsageStatsManagerInternal; import android.content.ComponentName; import android.content.ContentResolver; Loading Loading @@ -1743,12 +1743,11 @@ public final class SystemServer implements Dumpable { mSystemServiceManager.startService(LogcatManagerService.class); t.traceEnd(); if (AppFunctionManagerConfiguration.isSupported(context)) { t.traceBegin("StartAppFunctionManager"); if (enableAppFunctionManager()) { mSystemServiceManager.startService(AppFunctionManagerService.class); } t.traceEnd(); } } catch (Throwable e) { Slog.e("System", "******************************************"); Slog.e("System", "************ Failure starting core service"); Loading