Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (C) 2014 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;
import static android.app.ActivityManager.StopUserOnSwitch;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.UserIdInt;
import android.app.ActivityManager.ProcessCapability;
import android.app.ActivityManager.RestrictionLevel;
import android.content.ComponentName;
import android.content.IIntentReceiver;
import android.content.IIntentSender;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ActivityPresentationInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.UserInfo;
import android.net.Uri;
import android.os.Bundle;
import android.os.IBinder;
import android.os.PowerExemptionManager.ReasonCode;
import android.os.PowerExemptionManager.TempAllowListType;
import android.os.TransactionTooLargeException;
import android.os.WorkSource;
import android.util.ArraySet;
import android.util.Pair;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Activity manager local system service interface.
*
* @hide Only for use within the system server.
*/
public abstract class ActivityManagerInternal {
public enum ServiceNotificationPolicy {
/**
* The Notification is not associated with any foreground service.
*/
NOT_FOREGROUND_SERVICE,
/**
* The Notification is associated with a foreground service, but the
* notification system should handle it just like non-FGS notifications.
*/
SHOW_IMMEDIATELY,
/**
* The Notification is associated with a foreground service, and the
* notification system should ignore it unless it has already been shown (in
* which case it should be used to update the currently displayed UI).
*/
UPDATE_ONLY
}
// Access modes for handleIncomingUser.
/**
* Allows access to a caller with {@link android.Manifest.permission#INTERACT_ACROSS_USERS}.
*/
public static final int ALLOW_NON_FULL = 0;
/**
* Allows access to a caller with {@link android.Manifest.permission#INTERACT_ACROSS_USERS}
* if in the same profile group.
* Otherwise, {@link android.Manifest.permission#INTERACT_ACROSS_USERS_FULL} is required.
*/
public static final int ALLOW_NON_FULL_IN_PROFILE = 1;
/**
* Allows access to a caller only if it has the full
* {@link android.Manifest.permission#INTERACT_ACROSS_USERS_FULL}.
*/
public static final int ALLOW_FULL_ONLY = 2;
/**
* Allows access to a caller with {@link android.Manifest.permission#INTERACT_ACROSS_PROFILES}
* if in the same profile group.
* Otherwise, {@link android.Manifest.permission#INTERACT_ACROSS_USERS} is required and suffices
* as in {@link #ALLOW_NON_FULL}.
*/
public static final int ALLOW_PROFILES_OR_NON_FULL = 3;
/**
* Returns profile information in free form string in two separate strings.
* See AppProfiler for the output format.
* The output can only be used for human consumption. The format may change
* in the future.
* Do not call it frequently.
* @param time uptime for the cpu state
* @param lines lines of the cpu state should be returned
* @return a pair of Strings. The first is the current cpu load, the second is the cpu state.
*/
public abstract Pair getAppProfileStatsForDebugging(long time, int lines);
/**
* Verify that calling app has access to the given provider.
*/
public abstract String checkContentProviderAccess(String authority, @UserIdInt int userId);
/**
* Verify that calling UID has access to the given provider.
*/
public abstract int checkContentProviderUriPermission(Uri uri, @UserIdInt int userId,
int callingUid, int modeFlags);
// Called by the power manager.
public abstract void onWakefulnessChanged(int wakefulness);
/**
* @return {@code true} if process start is successful, {@code false} otherwise.
*/
public abstract boolean startIsolatedProcess(String entryPoint, String[] mainArgs,
String processName, String abiOverride, int uid, Runnable crashHandler);
/**
* Called when a user has been deleted. This can happen during normal device usage
* or just at startup, when partially removed users are purged. Any state persisted by the
* ActivityManager should be purged now.
*
* @param userId The user being cleaned up.
*/
public abstract void onUserRemoved(@UserIdInt int userId);
/**
* Kill foreground apps from the specified user.
*/
public abstract void killForegroundAppsForUser(@UserIdInt int userId);
/**
* Sets how long a {@link PendingIntent} can be temporarily allowlisted to bypass restrictions
* such as Power Save mode.
* @param target
* @param allowlistToken
* @param duration temp allowlist duration in milliseconds.
* @param type temp allowlist type defined at {@link TempAllowListType}
* @param reasonCode one of {@link ReasonCode}
* @param reason A human-readable reason for logging purposes.
*/
public abstract void setPendingIntentAllowlistDuration(IIntentSender target,
IBinder allowlistToken, long duration, @TempAllowListType int type,
@ReasonCode int reasonCode, @Nullable String reason);
/**
* Returns the flags set for a {@link PendingIntent}.
*/
public abstract int getPendingIntentFlags(IIntentSender target);
/**
* Allows a {@link PendingIntent} to start activities from background.
*/
public abstract void setPendingIntentAllowBgActivityStarts(
IIntentSender target, IBinder allowlistToken, int flags);
/**
* Voids {@link PendingIntent}'s privilege to start activities from background.
*/
public abstract void clearPendingIntentAllowBgActivityStarts(IIntentSender target,
IBinder allowlistToken);
/**
* Allow DeviceIdleController to tell us about what apps are allowlisted.
*/
public abstract void setDeviceIdleAllowlist(int[] allAppids, int[] exceptIdleAppids);
/**
* Update information about which app IDs are on the temp allowlist.
* @param appids the updated list of appIds in temp allowlist.
* If null, it is to update only changingUid.
* @param changingUid uid to add or remove to temp allowlist.
* @param adding true to add to temp allowlist, false to remove from temp allowlist.
* @param durationMs when adding is true, the duration to be in temp allowlist.
* @param type temp allowlist type defined at {@link TempAllowListType}.
* @param reasonCode one of {@link ReasonCode}
* @param reason A human-readable reason for logging purposes.
* @param callingUid the callingUid that setup this temp allowlist, only valid when param adding
* is true.
*/
public abstract void updateDeviceIdleTempAllowlist(@Nullable int[] appids, int changingUid,
boolean adding, long durationMs, @TempAllowListType int type,
@ReasonCode int reasonCode,
@Nullable String reason, int callingUid);
/**
* Get the procstate for the UID. The return value will be between
* {@link ActivityManager#MIN_PROCESS_STATE} and {@link ActivityManager#MAX_PROCESS_STATE}.
* Note if the UID doesn't exist, it'll return {@link ActivityManager#PROCESS_STATE_NONEXISTENT}
* (-1).
*/
public abstract int getUidProcessState(int uid);
/**
* Get a map of pid and package name that process of that pid Android/data and Android/obb
* directory is not mounted to lowerfs.
*/
public abstract Map getProcessesWithPendingBindMounts(int userId);
/**
* @return {@code true} if system is ready, {@code false} otherwise.
*/
public abstract boolean isSystemReady();
/**
* Returns package name given pid.
*
* @param pid The pid we are searching package name for.
*/
@Nullable
public abstract String getPackageNameByPid(int pid);
/**
* Sets if the given pid has an overlay UI or not.
*
* @param pid The pid we are setting overlay UI for.
* @param hasOverlayUi True if the process has overlay UI.
* @see android.view.WindowManager.LayoutParams#TYPE_APPLICATION_OVERLAY
*/
public abstract void setHasOverlayUi(int pid, boolean hasOverlayUi);
/**
* Called after the network policy rules are updated by
* {@link com.android.server.net.NetworkPolicyManagerService} for a specific {@param uid} and
* {@param procStateSeq}.
*/
public abstract void notifyNetworkPolicyRulesUpdated(int uid, long procStateSeq);
/**
* Inform ActivityManagerService about the latest {@code blockedReasons} for an uid, which
* can be used to understand whether the {@code uid} is allowed to access network or not.
*/
public abstract void onUidBlockedReasonsChanged(int uid, int blockedReasons);
/**
* @return true if runtime was restarted, false if it's normal boot
*/
public abstract boolean isRuntimeRestarted();
/**
* Returns if more users can be started without stopping currently running users.
*/
public abstract boolean canStartMoreUsers();
/**
* Sets the user switcher message for switching from {@link android.os.UserHandle#SYSTEM}.
*/
public abstract void setSwitchingFromSystemUserMessage(String switchingFromSystemUserMessage);
/**
* Sets the user switcher message for switching to {@link android.os.UserHandle#SYSTEM}.
*/
public abstract void setSwitchingToSystemUserMessage(String switchingToSystemUserMessage);
/**
* Returns maximum number of users that can run simultaneously.
*/
public abstract int getMaxRunningUsers();
/**
* Whether an UID is active or idle.
*/
public abstract boolean isUidActive(int uid);
/**
* Returns a list of running processes along with corresponding uids, pids and their oom score.
*
* Only processes managed by ActivityManagerService are included.
*/
public abstract List getMemoryStateForProcesses();
/**
* Checks to see if the calling pid is allowed to handle the user. Returns adjusted user id as
* needed.
*/
public abstract int handleIncomingUser(int callingPid, int callingUid, @UserIdInt int userId,
boolean allowAll, int allowMode, String name, String callerPackage);
/** Checks if the calling binder pid as the permission. */
public abstract void enforceCallingPermission(String permission, String func);
/** Returns the current user id. */
public abstract int getCurrentUserId();
/** Returns the currently started user ids. */
public abstract int[] getStartedUserIds();
/** Returns true if the user is running. */
public abstract boolean isUserRunning(@UserIdInt int userId, int flags);
/** Trims memory usage in the system by removing/stopping unused application processes. */
public abstract void trimApplications();
/** Kill the processes in the list due to their tasks been removed. */
public abstract void killProcessesForRemovedTask(ArrayList