// Signature format: 2.0
package com.android.server {

  public final class LocalManagerRegistry {
    method public static <T> void addManager(@NonNull Class<T>, @NonNull T);
    method @Nullable public static <T> T getManager(@NonNull Class<T>);
  }

  public abstract class SystemService {
    ctor public SystemService(@NonNull android.content.Context);
    method @NonNull public final android.content.Context getContext();
    method public boolean isUserSupported(@NonNull com.android.server.SystemService.TargetUser);
    method public void onBootPhase(int);
    method public abstract void onStart();
    method public void onUserStarting(@NonNull com.android.server.SystemService.TargetUser);
    method public void onUserStopped(@NonNull com.android.server.SystemService.TargetUser);
    method public void onUserStopping(@NonNull com.android.server.SystemService.TargetUser);
    method public void onUserSwitching(@Nullable com.android.server.SystemService.TargetUser, @NonNull com.android.server.SystemService.TargetUser);
    method public void onUserUnlocked(@NonNull com.android.server.SystemService.TargetUser);
    method public void onUserUnlocking(@NonNull com.android.server.SystemService.TargetUser);
    method protected final void publishBinderService(@NonNull String, @NonNull android.os.IBinder);
    method protected final void publishBinderService(@NonNull String, @NonNull android.os.IBinder, boolean);
    field public static final int PHASE_ACTIVITY_MANAGER_READY = 550; // 0x226
    field public static final int PHASE_BOOT_COMPLETED = 1000; // 0x3e8
    field public static final int PHASE_DEVICE_SPECIFIC_SERVICES_READY = 520; // 0x208
    field public static final int PHASE_LOCK_SETTINGS_READY = 480; // 0x1e0
    field public static final int PHASE_SYSTEM_SERVICES_READY = 500; // 0x1f4
    field public static final int PHASE_THIRD_PARTY_APPS_CAN_START = 600; // 0x258
    field public static final int PHASE_WAIT_FOR_DEFAULT_DISPLAY = 100; // 0x64
  }

  public static final class SystemService.TargetUser {
    method @NonNull public android.os.UserHandle getUserHandle();
  }

}

package com.android.server.am {

  public interface ActivityManagerLocal {
    method public boolean canStartForegroundService(int, int, @NonNull String);
  }

}

package com.android.server.role {

  public interface RoleServicePlatformHelper {
    method @NonNull public String computePackageStateHash(int);
    method @NonNull public java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getLegacyRoleState(int);
  }

}

package com.android.server.stats {

  public final class StatsHelper {
    method public static void sendStatsdReadyBroadcast(@NonNull android.content.Context);
  }

}

package com.android.server.wifi {

  public class SupplicantManager {
    method public static void start();
    method public static void stop();
  }

}

