// 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 bindSdkSandboxService(@NonNull android.content.Intent, @NonNull android.content.ServiceConnection, int, @NonNull String, @NonNull String, int) throws android.os.RemoteException;
    method public boolean canStartForegroundService(int, int, @NonNull String);
  }

}

package com.android.server.pm {

  public interface PackageManagerLocal {
    method public void reconcileSdkData(@Nullable String, @NonNull String, @NonNull java.util.List<java.lang.String>, int, int, int, @NonNull String, int) throws java.io.IOException;
    field public static final int FLAG_STORAGE_CE = 2; // 0x2
    field public static final int FLAG_STORAGE_DE = 1; // 0x1
  }

}

package com.android.server.pm.snapshot {

  public interface PackageDataSnapshot {
  }

}

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.usage {

  public interface StorageStatsManagerLocal {
    method public void registerStorageStatsAugmenter(@NonNull com.android.server.usage.StorageStatsManagerLocal.StorageStatsAugmenter, @NonNull String);
  }

  public static interface StorageStatsManagerLocal.StorageStatsAugmenter {
    method public void augmentStatsForPackageForUser(@NonNull android.content.pm.PackageStats, @NonNull String, @NonNull android.os.UserHandle, boolean);
    method public void augmentStatsForUid(@NonNull android.content.pm.PackageStats, int, boolean);
    method public void augmentStatsForUser(@NonNull android.content.pm.PackageStats, @NonNull android.os.UserHandle);
  }

}

package com.android.server.wifi {

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

}

