code
stringlengths
11
173k
docstring
stringlengths
2
593k
func_name
stringlengths
2
189
language
stringclasses
1 value
repo
stringclasses
844 values
path
stringlengths
11
294
url
stringlengths
60
339
license
stringclasses
4 values
void notifyActivityUnpinned() { mHandler.removeMessages(NOTIFY_ACTIVITY_UNPINNED_LISTENERS_MSG); final Message msg = mHandler.obtainMessage(NOTIFY_ACTIVITY_UNPINNED_LISTENERS_MSG); forAllLocalListeners(mNotifyActivityUnpinned, msg); msg.sendToTarget(); }
/* Copyright (C) 2016 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 com.android.server.wm; import android.app.ActivityManager; import android.app.ActivityManager.RunningTaskInfo; import android.app.ITaskStackListener; import android.app.TaskInfo; import android.content.ComponentName; import android.os.Binder; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.os.RemoteCallbackList; import android.os.RemoteException; import android.window.TaskSnapshot; import com.android.internal.os.SomeArgs; import java.util.ArrayList; class TaskChangeNotificationController { private static final int LOG_TASK_STATE_MSG = 1; private static final int NOTIFY_TASK_STACK_CHANGE_LISTENERS_MSG = 2; private static final int NOTIFY_ACTIVITY_PINNED_LISTENERS_MSG = 3; private static final int NOTIFY_ACTIVITY_RESTART_ATTEMPT_LISTENERS_MSG = 4; private static final int NOTIFY_FORCED_RESIZABLE_MSG = 6; private static final int NOTIFY_ACTIVITY_DISMISSING_DOCKED_ROOT_TASK_MSG = 7; private static final int NOTIFY_TASK_ADDED_LISTENERS_MSG = 8; private static final int NOTIFY_TASK_REMOVED_LISTENERS_MSG = 9; private static final int NOTIFY_TASK_MOVED_TO_FRONT_LISTENERS_MSG = 10; private static final int NOTIFY_TASK_DESCRIPTION_CHANGED_LISTENERS_MSG = 11; private static final int NOTIFY_ACTIVITY_REQUESTED_ORIENTATION_CHANGED_LISTENERS = 12; private static final int NOTIFY_TASK_REMOVAL_STARTED_LISTENERS = 13; private static final int NOTIFY_TASK_PROFILE_LOCKED_LISTENERS_MSG = 14; private static final int NOTIFY_TASK_SNAPSHOT_CHANGED_LISTENERS_MSG = 15; private static final int NOTIFY_ACTIVITY_UNPINNED_LISTENERS_MSG = 17; private static final int NOTIFY_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_FAILED_MSG = 18; private static final int NOTIFY_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_REROUTED_MSG = 19; private static final int NOTIFY_BACK_PRESSED_ON_TASK_ROOT = 20; private static final int NOTIFY_TASK_DISPLAY_CHANGED_LISTENERS_MSG = 21; private static final int NOTIFY_TASK_LIST_UPDATED_LISTENERS_MSG = 22; private static final int NOTIFY_TASK_LIST_FROZEN_UNFROZEN_MSG = 23; private static final int NOTIFY_TASK_FOCUS_CHANGED_MSG = 24; private static final int NOTIFY_TASK_REQUESTED_ORIENTATION_CHANGED_MSG = 25; private static final int NOTIFY_ACTIVITY_ROTATED_MSG = 26; private static final int NOTIFY_TASK_MOVED_TO_BACK_LISTENERS_MSG = 27; private static final int NOTIFY_LOCK_TASK_MODE_CHANGED_MSG = 28; // Delay in notifying task stack change listeners (in millis) private static final int NOTIFY_TASK_STACK_CHANGE_LISTENERS_DELAY = 100; // Global lock used by the service the instantiate objects of this class. private final Object mServiceLock; private final ActivityTaskSupervisor mTaskSupervisor; private final Handler mHandler; // Task stack change listeners in a remote process. private final RemoteCallbackList<ITaskStackListener> mRemoteTaskStackListeners = new RemoteCallbackList<>(); /* Task stack change listeners in a local process. Tracked separately so that they can be called on the same thread. private final ArrayList<ITaskStackListener> mLocalTaskStackListeners = new ArrayList<>(); private final TaskStackConsumer mNotifyTaskStackChanged = (l, m) -> { l.onTaskStackChanged(); }; private final TaskStackConsumer mNotifyTaskCreated = (l, m) -> { l.onTaskCreated(m.arg1, (ComponentName) m.obj); }; private final TaskStackConsumer mNotifyTaskRemoved = (l, m) -> { l.onTaskRemoved(m.arg1); }; private final TaskStackConsumer mNotifyTaskMovedToFront = (l, m) -> { l.onTaskMovedToFront((RunningTaskInfo) m.obj); }; private final TaskStackConsumer mNotifyTaskDescriptionChanged = (l, m) -> { l.onTaskDescriptionChanged((RunningTaskInfo) m.obj); }; private final TaskStackConsumer mNotifyBackPressedOnTaskRoot = (l, m) -> { l.onBackPressedOnTaskRoot((RunningTaskInfo) m.obj); }; private final TaskStackConsumer mNotifyActivityRequestedOrientationChanged = (l, m) -> { l.onActivityRequestedOrientationChanged(m.arg1, m.arg2); }; private final TaskStackConsumer mNotifyTaskRemovalStarted = (l, m) -> { l.onTaskRemovalStarted((RunningTaskInfo) m.obj); }; private final TaskStackConsumer mNotifyActivityPinned = (l, m) -> { l.onActivityPinned((String) m.obj /* packageName */, m.sendingUid /* userId */, m.arg1 /* taskId */, m.arg2 /* stackId */); }; private final TaskStackConsumer mNotifyActivityUnpinned = (l, m) -> { l.onActivityUnpinned(); }; private final TaskStackConsumer mNotifyActivityRestartAttempt = (l, m) -> { SomeArgs args = (SomeArgs) m.obj; l.onActivityRestartAttempt((RunningTaskInfo) args.arg1, args.argi1 != 0, args.argi2 != 0, args.argi3 != 0); }; private final TaskStackConsumer mNotifyActivityForcedResizable = (l, m) -> { l.onActivityForcedResizable((String) m.obj, m.arg1, m.arg2); }; private final TaskStackConsumer mNotifyActivityDismissingDockedTask = (l, m) -> { l.onActivityDismissingDockedTask(); }; private final TaskStackConsumer mNotifyActivityLaunchOnSecondaryDisplayFailed = (l, m) -> { l.onActivityLaunchOnSecondaryDisplayFailed((RunningTaskInfo) m.obj, m.arg1); }; private final TaskStackConsumer mNotifyActivityLaunchOnSecondaryDisplayRerouted = (l, m) -> { l.onActivityLaunchOnSecondaryDisplayRerouted((RunningTaskInfo) m.obj, m.arg1); }; private final TaskStackConsumer mNotifyTaskProfileLocked = (l, m) -> { l.onTaskProfileLocked(m.arg1, m.arg2); }; private final TaskStackConsumer mNotifyTaskSnapshotChanged = (l, m) -> { l.onTaskSnapshotChanged(m.arg1, (TaskSnapshot) m.obj); }; private final TaskStackConsumer mNotifyTaskDisplayChanged = (l, m) -> { l.onTaskDisplayChanged(m.arg1, m.arg2); }; private final TaskStackConsumer mNotifyTaskListUpdated = (l, m) -> { l.onRecentTaskListUpdated(); }; private final TaskStackConsumer mNotifyTaskListFrozen = (l, m) -> { l.onRecentTaskListFrozenChanged(m.arg1 != 0); }; private final TaskStackConsumer mNotifyTaskFocusChanged = (l, m) -> { l.onTaskFocusChanged(m.arg1, m.arg2 != 0); }; private final TaskStackConsumer mNotifyTaskRequestedOrientationChanged = (l, m) -> { l.onTaskRequestedOrientationChanged(m.arg1, m.arg2); }; private final TaskStackConsumer mNotifyOnActivityRotation = (l, m) -> { l.onActivityRotation(m.arg1); }; private final TaskStackConsumer mNotifyTaskMovedToBack = (l, m) -> { l.onTaskMovedToBack((RunningTaskInfo) m.obj); }; private final TaskStackConsumer mNotifyLockTaskModeChanged = (l, m) -> { l.onLockTaskModeChanged(m.arg1); }; @FunctionalInterface public interface TaskStackConsumer { void accept(ITaskStackListener t, Message m) throws RemoteException; } private class MainHandler extends Handler { public MainHandler(Looper looper) { super(looper); } @Override public void handleMessage(Message msg) { switch (msg.what) { case LOG_TASK_STATE_MSG: { synchronized (mServiceLock) { mTaskSupervisor.logRootTaskState(); } break; } case NOTIFY_TASK_STACK_CHANGE_LISTENERS_MSG: forAllRemoteListeners(mNotifyTaskStackChanged, msg); break; case NOTIFY_TASK_ADDED_LISTENERS_MSG: forAllRemoteListeners(mNotifyTaskCreated, msg); break; case NOTIFY_TASK_REMOVED_LISTENERS_MSG: forAllRemoteListeners(mNotifyTaskRemoved, msg); break; case NOTIFY_TASK_MOVED_TO_FRONT_LISTENERS_MSG: forAllRemoteListeners(mNotifyTaskMovedToFront, msg); break; case NOTIFY_TASK_DESCRIPTION_CHANGED_LISTENERS_MSG: forAllRemoteListeners(mNotifyTaskDescriptionChanged, msg); break; case NOTIFY_ACTIVITY_REQUESTED_ORIENTATION_CHANGED_LISTENERS: forAllRemoteListeners(mNotifyActivityRequestedOrientationChanged, msg); break; case NOTIFY_TASK_REMOVAL_STARTED_LISTENERS: forAllRemoteListeners(mNotifyTaskRemovalStarted, msg); break; case NOTIFY_ACTIVITY_PINNED_LISTENERS_MSG: forAllRemoteListeners(mNotifyActivityPinned, msg); break; case NOTIFY_ACTIVITY_UNPINNED_LISTENERS_MSG: forAllRemoteListeners(mNotifyActivityUnpinned, msg); break; case NOTIFY_ACTIVITY_RESTART_ATTEMPT_LISTENERS_MSG: forAllRemoteListeners(mNotifyActivityRestartAttempt, msg); break; case NOTIFY_FORCED_RESIZABLE_MSG: forAllRemoteListeners(mNotifyActivityForcedResizable, msg); break; case NOTIFY_ACTIVITY_DISMISSING_DOCKED_ROOT_TASK_MSG: forAllRemoteListeners(mNotifyActivityDismissingDockedTask, msg); break; case NOTIFY_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_FAILED_MSG: forAllRemoteListeners(mNotifyActivityLaunchOnSecondaryDisplayFailed, msg); break; case NOTIFY_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_REROUTED_MSG: forAllRemoteListeners(mNotifyActivityLaunchOnSecondaryDisplayRerouted, msg); break; case NOTIFY_TASK_PROFILE_LOCKED_LISTENERS_MSG: forAllRemoteListeners(mNotifyTaskProfileLocked, msg); break; case NOTIFY_TASK_SNAPSHOT_CHANGED_LISTENERS_MSG: forAllRemoteListeners(mNotifyTaskSnapshotChanged, msg); break; case NOTIFY_BACK_PRESSED_ON_TASK_ROOT: forAllRemoteListeners(mNotifyBackPressedOnTaskRoot, msg); break; case NOTIFY_TASK_DISPLAY_CHANGED_LISTENERS_MSG: forAllRemoteListeners(mNotifyTaskDisplayChanged, msg); break; case NOTIFY_TASK_LIST_UPDATED_LISTENERS_MSG: forAllRemoteListeners(mNotifyTaskListUpdated, msg); break; case NOTIFY_TASK_LIST_FROZEN_UNFROZEN_MSG: forAllRemoteListeners(mNotifyTaskListFrozen, msg); break; case NOTIFY_TASK_FOCUS_CHANGED_MSG: forAllRemoteListeners(mNotifyTaskFocusChanged, msg); break; case NOTIFY_TASK_REQUESTED_ORIENTATION_CHANGED_MSG: forAllRemoteListeners(mNotifyTaskRequestedOrientationChanged, msg); break; case NOTIFY_ACTIVITY_ROTATED_MSG: forAllRemoteListeners(mNotifyOnActivityRotation, msg); break; case NOTIFY_TASK_MOVED_TO_BACK_LISTENERS_MSG: forAllRemoteListeners(mNotifyTaskMovedToBack, msg); break; case NOTIFY_LOCK_TASK_MODE_CHANGED_MSG: forAllRemoteListeners(mNotifyLockTaskModeChanged, msg); break; } if (msg.obj instanceof SomeArgs) { ((SomeArgs) msg.obj).recycle(); } } } public TaskChangeNotificationController(Object serviceLock, ActivityTaskSupervisor taskSupervisor, Handler handler) { mServiceLock = serviceLock; mTaskSupervisor = taskSupervisor; mHandler = new MainHandler(handler.getLooper()); } public void registerTaskStackListener(ITaskStackListener listener) { synchronized (mServiceLock) { if (listener != null) { if (Binder.getCallingPid() == android.os.Process.myPid()) { if (!mLocalTaskStackListeners.contains(listener)) { mLocalTaskStackListeners.add(listener); } } else { mRemoteTaskStackListeners.register(listener); } } } } public void unregisterTaskStackListener(ITaskStackListener listener) { synchronized (mServiceLock) { if (listener != null) { if (Binder.getCallingPid() == android.os.Process.myPid()) { mLocalTaskStackListeners.remove(listener); } else { mRemoteTaskStackListeners.unregister(listener); } } } } private void forAllRemoteListeners(TaskStackConsumer callback, Message message) { synchronized (mServiceLock) { for (int i = mRemoteTaskStackListeners.beginBroadcast() - 1; i >= 0; i--) { try { // Make a one-way callback to the listener callback.accept(mRemoteTaskStackListeners.getBroadcastItem(i), message); } catch (RemoteException e) { // Handled by the RemoteCallbackList. } } mRemoteTaskStackListeners.finishBroadcast(); } } private void forAllLocalListeners(TaskStackConsumer callback, Message message) { synchronized (mServiceLock) { for (int i = mLocalTaskStackListeners.size() - 1; i >= 0; i--) { try { callback.accept(mLocalTaskStackListeners.get(i), message); } catch (RemoteException e) { // Never thrown since this is called locally. } } } } /** Notifies all listeners when the task stack has changed. void notifyTaskStackChanged() { mHandler.sendEmptyMessage(LOG_TASK_STATE_MSG); mHandler.removeMessages(NOTIFY_TASK_STACK_CHANGE_LISTENERS_MSG); final Message msg = mHandler.obtainMessage(NOTIFY_TASK_STACK_CHANGE_LISTENERS_MSG); forAllLocalListeners(mNotifyTaskStackChanged, msg); // Only the main task stack change notification requires a delay. mHandler.sendMessageDelayed(msg, NOTIFY_TASK_STACK_CHANGE_LISTENERS_DELAY); } /** Notifies all listeners when an Activity is pinned. void notifyActivityPinned(ActivityRecord r) { mHandler.removeMessages(NOTIFY_ACTIVITY_PINNED_LISTENERS_MSG); final Message msg = mHandler.obtainMessage(NOTIFY_ACTIVITY_PINNED_LISTENERS_MSG, r.getTask().mTaskId, r.getRootTaskId(), r.packageName); msg.sendingUid = r.mUserId; forAllLocalListeners(mNotifyActivityPinned, msg); msg.sendToTarget(); } /** Notifies all listeners when an Activity is unpinned.
MainHandler::notifyActivityUnpinned
java
Reginer/aosp-android-jar
android-31/src/com/android/server/wm/TaskChangeNotificationController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/wm/TaskChangeNotificationController.java
MIT
void notifyActivityRestartAttempt(RunningTaskInfo task, boolean homeTaskVisible, boolean clearedTask, boolean wasVisible) { mHandler.removeMessages(NOTIFY_ACTIVITY_RESTART_ATTEMPT_LISTENERS_MSG); final SomeArgs args = SomeArgs.obtain(); args.arg1 = task; args.argi1 = homeTaskVisible ? 1 : 0; args.argi2 = clearedTask ? 1 : 0; args.argi3 = wasVisible ? 1 : 0; final Message msg = mHandler.obtainMessage(NOTIFY_ACTIVITY_RESTART_ATTEMPT_LISTENERS_MSG, args); forAllLocalListeners(mNotifyActivityRestartAttempt, msg); msg.sendToTarget(); }
Notifies all listeners when an attempt was made to start an an activity that is already running, but the task is either brought to the front or a new Intent is delivered to it.
MainHandler::notifyActivityRestartAttempt
java
Reginer/aosp-android-jar
android-31/src/com/android/server/wm/TaskChangeNotificationController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/wm/TaskChangeNotificationController.java
MIT
void notifyTaskRemovalStarted(ActivityManager.RunningTaskInfo taskInfo) { final Message msg = mHandler.obtainMessage(NOTIFY_TASK_REMOVAL_STARTED_LISTENERS, taskInfo); forAllLocalListeners(mNotifyTaskRemovalStarted, msg); msg.sendToTarget(); }
Notify listeners that the task is about to be finished before its surfaces are removed from the window manager. This allows interested parties to perform relevant animations before the window disappears.
MainHandler::notifyTaskRemovalStarted
java
Reginer/aosp-android-jar
android-31/src/com/android/server/wm/TaskChangeNotificationController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/wm/TaskChangeNotificationController.java
MIT
void notifyTaskProfileLocked(int taskId, int userId) { final Message msg = mHandler.obtainMessage(NOTIFY_TASK_PROFILE_LOCKED_LISTENERS_MSG, taskId, userId); forAllLocalListeners(mNotifyTaskProfileLocked, msg); msg.sendToTarget(); }
Notify listeners that the task has been put in a locked state because one or more of the activities inside it belong to a managed profile user that has been locked.
MainHandler::notifyTaskProfileLocked
java
Reginer/aosp-android-jar
android-31/src/com/android/server/wm/TaskChangeNotificationController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/wm/TaskChangeNotificationController.java
MIT
void notifyTaskSnapshotChanged(int taskId, TaskSnapshot snapshot) { final Message msg = mHandler.obtainMessage(NOTIFY_TASK_SNAPSHOT_CHANGED_LISTENERS_MSG, taskId, 0, snapshot); forAllLocalListeners(mNotifyTaskSnapshotChanged, msg); msg.sendToTarget(); }
Notify listeners that the snapshot of a task has changed.
MainHandler::notifyTaskSnapshotChanged
java
Reginer/aosp-android-jar
android-31/src/com/android/server/wm/TaskChangeNotificationController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/wm/TaskChangeNotificationController.java
MIT
void notifyBackPressedOnTaskRoot(TaskInfo taskInfo) { final Message msg = mHandler.obtainMessage(NOTIFY_BACK_PRESSED_ON_TASK_ROOT, taskInfo); forAllLocalListeners(mNotifyBackPressedOnTaskRoot, msg); msg.sendToTarget(); }
Notify listeners that an activity received a back press when there are no other activities in the back stack.
MainHandler::notifyBackPressedOnTaskRoot
java
Reginer/aosp-android-jar
android-31/src/com/android/server/wm/TaskChangeNotificationController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/wm/TaskChangeNotificationController.java
MIT
void notifyTaskDisplayChanged(int taskId, int newDisplayId) { final Message msg = mHandler.obtainMessage(NOTIFY_TASK_DISPLAY_CHANGED_LISTENERS_MSG, taskId, newDisplayId); forAllLocalListeners(mNotifyTaskDisplayChanged, msg); msg.sendToTarget(); }
Notify listeners that a task is reparented to another display.
MainHandler::notifyTaskDisplayChanged
java
Reginer/aosp-android-jar
android-31/src/com/android/server/wm/TaskChangeNotificationController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/wm/TaskChangeNotificationController.java
MIT
void notifyTaskListUpdated() { final Message msg = mHandler.obtainMessage(NOTIFY_TASK_LIST_UPDATED_LISTENERS_MSG); forAllLocalListeners(mNotifyTaskListUpdated, msg); msg.sendToTarget(); }
Called when any additions or deletions to the recent tasks list have been made.
MainHandler::notifyTaskListUpdated
java
Reginer/aosp-android-jar
android-31/src/com/android/server/wm/TaskChangeNotificationController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/wm/TaskChangeNotificationController.java
MIT
void notifyTaskListFrozen(boolean frozen) { final Message msg = mHandler.obtainMessage(NOTIFY_TASK_LIST_FROZEN_UNFROZEN_MSG, frozen ? 1 : 0, 0 /* unused */); forAllLocalListeners(mNotifyTaskListFrozen, msg); msg.sendToTarget(); }
Called when any additions or deletions to the recent tasks list have been made. void notifyTaskListUpdated() { final Message msg = mHandler.obtainMessage(NOTIFY_TASK_LIST_UPDATED_LISTENERS_MSG); forAllLocalListeners(mNotifyTaskListUpdated, msg); msg.sendToTarget(); } /** @see ITaskStackListener#onRecentTaskListFrozenChanged(boolean)
MainHandler::notifyTaskListFrozen
java
Reginer/aosp-android-jar
android-31/src/com/android/server/wm/TaskChangeNotificationController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/wm/TaskChangeNotificationController.java
MIT
void notifyTaskFocusChanged(int taskId, boolean focused) { final Message msg = mHandler.obtainMessage(NOTIFY_TASK_FOCUS_CHANGED_MSG, taskId, focused ? 1 : 0); forAllLocalListeners(mNotifyTaskFocusChanged, msg); msg.sendToTarget(); }
Called when any additions or deletions to the recent tasks list have been made. void notifyTaskListUpdated() { final Message msg = mHandler.obtainMessage(NOTIFY_TASK_LIST_UPDATED_LISTENERS_MSG); forAllLocalListeners(mNotifyTaskListUpdated, msg); msg.sendToTarget(); } /** @see ITaskStackListener#onRecentTaskListFrozenChanged(boolean) void notifyTaskListFrozen(boolean frozen) { final Message msg = mHandler.obtainMessage(NOTIFY_TASK_LIST_FROZEN_UNFROZEN_MSG, frozen ? 1 : 0, 0 /* unused */); forAllLocalListeners(mNotifyTaskListFrozen, msg); msg.sendToTarget(); } /** @see ITaskStackListener#onTaskFocusChanged(int, boolean)
MainHandler::notifyTaskFocusChanged
java
Reginer/aosp-android-jar
android-31/src/com/android/server/wm/TaskChangeNotificationController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/wm/TaskChangeNotificationController.java
MIT
void notifyTaskRequestedOrientationChanged(int taskId, int requestedOrientation) { final Message msg = mHandler.obtainMessage(NOTIFY_TASK_REQUESTED_ORIENTATION_CHANGED_MSG, taskId, requestedOrientation); forAllLocalListeners(mNotifyTaskRequestedOrientationChanged, msg); msg.sendToTarget(); }
Called when any additions or deletions to the recent tasks list have been made. void notifyTaskListUpdated() { final Message msg = mHandler.obtainMessage(NOTIFY_TASK_LIST_UPDATED_LISTENERS_MSG); forAllLocalListeners(mNotifyTaskListUpdated, msg); msg.sendToTarget(); } /** @see ITaskStackListener#onRecentTaskListFrozenChanged(boolean) void notifyTaskListFrozen(boolean frozen) { final Message msg = mHandler.obtainMessage(NOTIFY_TASK_LIST_FROZEN_UNFROZEN_MSG, frozen ? 1 : 0, 0 /* unused */); forAllLocalListeners(mNotifyTaskListFrozen, msg); msg.sendToTarget(); } /** @see ITaskStackListener#onTaskFocusChanged(int, boolean) void notifyTaskFocusChanged(int taskId, boolean focused) { final Message msg = mHandler.obtainMessage(NOTIFY_TASK_FOCUS_CHANGED_MSG, taskId, focused ? 1 : 0); forAllLocalListeners(mNotifyTaskFocusChanged, msg); msg.sendToTarget(); } /** @see android.app.ITaskStackListener#onTaskRequestedOrientationChanged(int, int)
MainHandler::notifyTaskRequestedOrientationChanged
java
Reginer/aosp-android-jar
android-31/src/com/android/server/wm/TaskChangeNotificationController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/wm/TaskChangeNotificationController.java
MIT
void notifyOnActivityRotation(int displayId) { final Message msg = mHandler.obtainMessage(NOTIFY_ACTIVITY_ROTATED_MSG, displayId, 0 /* unused */); forAllLocalListeners(mNotifyOnActivityRotation, msg); msg.sendToTarget(); }
Called when any additions or deletions to the recent tasks list have been made. void notifyTaskListUpdated() { final Message msg = mHandler.obtainMessage(NOTIFY_TASK_LIST_UPDATED_LISTENERS_MSG); forAllLocalListeners(mNotifyTaskListUpdated, msg); msg.sendToTarget(); } /** @see ITaskStackListener#onRecentTaskListFrozenChanged(boolean) void notifyTaskListFrozen(boolean frozen) { final Message msg = mHandler.obtainMessage(NOTIFY_TASK_LIST_FROZEN_UNFROZEN_MSG, frozen ? 1 : 0, 0 /* unused */); forAllLocalListeners(mNotifyTaskListFrozen, msg); msg.sendToTarget(); } /** @see ITaskStackListener#onTaskFocusChanged(int, boolean) void notifyTaskFocusChanged(int taskId, boolean focused) { final Message msg = mHandler.obtainMessage(NOTIFY_TASK_FOCUS_CHANGED_MSG, taskId, focused ? 1 : 0); forAllLocalListeners(mNotifyTaskFocusChanged, msg); msg.sendToTarget(); } /** @see android.app.ITaskStackListener#onTaskRequestedOrientationChanged(int, int) void notifyTaskRequestedOrientationChanged(int taskId, int requestedOrientation) { final Message msg = mHandler.obtainMessage(NOTIFY_TASK_REQUESTED_ORIENTATION_CHANGED_MSG, taskId, requestedOrientation); forAllLocalListeners(mNotifyTaskRequestedOrientationChanged, msg); msg.sendToTarget(); } /** @see android.app.ITaskStackListener#onActivityRotation(int)
MainHandler::notifyOnActivityRotation
java
Reginer/aosp-android-jar
android-31/src/com/android/server/wm/TaskChangeNotificationController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/wm/TaskChangeNotificationController.java
MIT
void notifyTaskMovedToBack(TaskInfo ti) { final Message msg = mHandler.obtainMessage(NOTIFY_TASK_MOVED_TO_BACK_LISTENERS_MSG, ti); forAllLocalListeners(mNotifyTaskMovedToBack, msg); msg.sendToTarget(); }
Notify that a task is being moved behind home.
MainHandler::notifyTaskMovedToBack
java
Reginer/aosp-android-jar
android-31/src/com/android/server/wm/TaskChangeNotificationController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/wm/TaskChangeNotificationController.java
MIT
@DataServiceCallback.ResultCode private int toResultCode(@Nullable Throwable t) { if (t == null) { return RESULT_SUCCESS; } else { if (t instanceof CommandException) { CommandException ce = (CommandException) t; if (ce.getCommandError() == CommandException.Error.REQUEST_NOT_SUPPORTED) { return DataServiceCallback.RESULT_ERROR_UNSUPPORTED; } else { return DataServiceCallback.RESULT_ERROR_ILLEGAL_STATE; } } else { loge("Throwable is of type " + t.getClass().getSimpleName() + " but should be CommandException"); return DataServiceCallback.RESULT_ERROR_ILLEGAL_STATE; } } }
This class represents cellular data service which handles telephony data requests and response from the cellular modem. public class CellularDataService extends DataService { private static final String TAG = CellularDataService.class.getSimpleName(); private static final boolean DBG = false; private static final int SETUP_DATA_CALL_COMPLETE = 1; private static final int DEACTIVATE_DATA_ALL_COMPLETE = 2; private static final int SET_INITIAL_ATTACH_APN_COMPLETE = 3; private static final int SET_DATA_PROFILE_COMPLETE = 4; private static final int REQUEST_DATA_CALL_LIST_COMPLETE = 5; private static final int DATA_CALL_LIST_CHANGED = 6; private static final int START_HANDOVER = 7; private static final int CANCEL_HANDOVER = 8; private static final int APN_UNTHROTTLED = 9; private class CellularDataServiceProvider extends DataService.DataServiceProvider { private final Map<Message, DataServiceCallback> mCallbackMap = new HashMap<>(); private final Handler mHandler; private final Phone mPhone; private CellularDataServiceProvider(int slotId) { super(slotId); mPhone = PhoneFactory.getPhone(getSlotIndex()); mHandler = new Handler(Looper.myLooper()) { @Override public void handleMessage(Message message) { DataServiceCallback callback = mCallbackMap.remove(message); AsyncResult ar = (AsyncResult) message.obj; switch (message.what) { case SETUP_DATA_CALL_COMPLETE: DataCallResponse response = (DataCallResponse) ar.result; callback.onSetupDataCallComplete(ar.exception != null ? DataServiceCallback.RESULT_ERROR_ILLEGAL_STATE : RESULT_SUCCESS, response); break; case DEACTIVATE_DATA_ALL_COMPLETE: callback.onDeactivateDataCallComplete(ar.exception != null ? DataServiceCallback.RESULT_ERROR_ILLEGAL_STATE : RESULT_SUCCESS); break; case SET_INITIAL_ATTACH_APN_COMPLETE: callback.onSetInitialAttachApnComplete(ar.exception != null ? DataServiceCallback.RESULT_ERROR_ILLEGAL_STATE : RESULT_SUCCESS); break; case SET_DATA_PROFILE_COMPLETE: callback.onSetDataProfileComplete(ar.exception != null ? DataServiceCallback.RESULT_ERROR_ILLEGAL_STATE : RESULT_SUCCESS); break; case REQUEST_DATA_CALL_LIST_COMPLETE: callback.onRequestDataCallListComplete( ar.exception != null ? DataServiceCallback.RESULT_ERROR_ILLEGAL_STATE : RESULT_SUCCESS, ar.exception != null ? null : (List<DataCallResponse>) ar.result ); break; case DATA_CALL_LIST_CHANGED: notifyDataCallListChanged((List<DataCallResponse>) ar.result); break; case START_HANDOVER: callback.onHandoverStarted(toResultCode(ar.exception)); break; case CANCEL_HANDOVER: callback.onHandoverCancelled(toResultCode(ar.exception)); break; case APN_UNTHROTTLED: notifyApnUnthrottled((String) ar.result); break; default: loge("Unexpected event: " + message.what); } } }; if (DBG) log("Register for data call list changed."); mPhone.mCi.registerForDataCallListChanged(mHandler, DATA_CALL_LIST_CHANGED, null); if (DBG) log("Register for apn unthrottled."); mPhone.mCi.registerForApnUnthrottled(mHandler, APN_UNTHROTTLED, null); } /* Converts the result code for start handover and cancel handover
getSimpleName::toResultCode
java
Reginer/aosp-android-jar
android-31/src/com/android/internal/telephony/dataconnection/CellularDataService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/internal/telephony/dataconnection/CellularDataService.java
MIT
public setAttributeNS05(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException { super(factory); // // check if loaded documents are supported for content type // String contentType = getContentType(); preload(contentType, "staffNS", true); }
Constructor. @param factory document factory, may not be null @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
setAttributeNS05::setAttributeNS05
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level2/core/setAttributeNS05.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level2/core/setAttributeNS05.java
MIT
public void runTest() throws Throwable { String localName = "newAttr"; String namespaceURI = "http://www.newattr.com"; String qualifiedName = "emp:newAttr"; Document doc; NodeList elementList; Node testAddr; Attr addrAttr; String resultAttr; doc = (Document) load("staffNS", true); elementList = doc.getElementsByTagName("emp:address"); testAddr = elementList.item(0); assertNotNull("empAddrNotNull", testAddr); ((Element) /*Node */testAddr).setAttributeNS(namespaceURI, qualifiedName, "<newValue>"); resultAttr = ((Element) /*Node */testAddr).getAttributeNS(namespaceURI, localName); assertEquals("throw_Equals", "<newValue>", resultAttr); }
Runs the test case. @throws Throwable Any uncaught exception causes test to fail
setAttributeNS05::runTest
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level2/core/setAttributeNS05.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level2/core/setAttributeNS05.java
MIT
public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS05"; }
Gets URI that identifies the test. @return uri identifier of test
setAttributeNS05::getTargetURI
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level2/core/setAttributeNS05.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level2/core/setAttributeNS05.java
MIT
public static void main(final String[] args) { DOMTestCase.doMain(setAttributeNS05.class, args); }
Runs this test from the command line. @param args command line arguments
setAttributeNS05::main
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level2/core/setAttributeNS05.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level2/core/setAttributeNS05.java
MIT
public static void register(CompositionSamplingListener listener, int displayId, SurfaceControl stopLayer, Rect samplingArea) { if (listener.mNativeListener == 0) { return; } Preconditions.checkArgument(displayId == Display.DEFAULT_DISPLAY, "default display only for now"); long nativeStopLayerObject = stopLayer != null ? stopLayer.mNativeObject : 0; nativeRegister(listener.mNativeListener, nativeStopLayerObject, samplingArea.left, samplingArea.top, samplingArea.right, samplingArea.bottom); }
Registers a sampling listener.
CompositionSamplingListener::register
java
Reginer/aosp-android-jar
android-34/src/android/view/CompositionSamplingListener.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/view/CompositionSamplingListener.java
MIT
public static void unregister(CompositionSamplingListener listener) { if (listener.mNativeListener == 0) { return; } nativeUnregister(listener.mNativeListener); }
Unregisters a sampling listener.
CompositionSamplingListener::unregister
java
Reginer/aosp-android-jar
android-34/src/android/view/CompositionSamplingListener.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/view/CompositionSamplingListener.java
MIT
private static void dispatchOnSampleCollected(CompositionSamplingListener listener, float medianLuma) { listener.mExecutor.execute(() -> listener.onSampleCollected(medianLuma)); }
Dispatch the collected sample. Called from native code on a binder thread.
CompositionSamplingListener::dispatchOnSampleCollected
java
Reginer/aosp-android-jar
android-34/src/android/view/CompositionSamplingListener.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/view/CompositionSamplingListener.java
MIT
public hc_nodetextnodeattribute(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException { super(factory); // // check if loaded documents are supported for content type // String contentType = getContentType(); preload(contentType, "hc_staff", false); }
Constructor. @param factory document factory, may not be null @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
hc_nodetextnodeattribute::hc_nodetextnodeattribute
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level1/core/hc_nodetextnodeattribute.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level1/core/hc_nodetextnodeattribute.java
MIT
public void runTest() throws Throwable { Document doc; NodeList elementList; Node testAddr; Node textNode; NamedNodeMap attrList; doc = (Document) load("hc_staff", false); elementList = doc.getElementsByTagName("acronym"); testAddr = elementList.item(0); textNode = testAddr.getFirstChild(); attrList = textNode.getAttributes(); assertNull("text_attributes_is_null", attrList); }
Runs the test case. @throws Throwable Any uncaught exception causes test to fail
hc_nodetextnodeattribute::runTest
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level1/core/hc_nodetextnodeattribute.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level1/core/hc_nodetextnodeattribute.java
MIT
public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodetextnodeattribute"; }
Gets URI that identifies the test. @return uri identifier of test
hc_nodetextnodeattribute::getTargetURI
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level1/core/hc_nodetextnodeattribute.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level1/core/hc_nodetextnodeattribute.java
MIT
public static void main(final String[] args) { DOMTestCase.doMain(hc_nodetextnodeattribute.class, args); }
Runs this test from the command line. @param args command line arguments
hc_nodetextnodeattribute::main
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level1/core/hc_nodetextnodeattribute.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level1/core/hc_nodetextnodeattribute.java
MIT
public String getReasonHeader() { return mReasonHeader; }
Gets the reason header associated with the SIP response code. @hide
PresSipResponse::getReasonHeader
java
Reginer/aosp-android-jar
android-34/src/com/android/ims/internal/uce/presence/PresSipResponse.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/ims/internal/uce/presence/PresSipResponse.java
MIT
public void setReasonHeader(String reasonHeader) { this.mReasonHeader = reasonHeader; }
Sets the SIP response code reason header. @hide
PresSipResponse::setReasonHeader
java
Reginer/aosp-android-jar
android-34/src/com/android/ims/internal/uce/presence/PresSipResponse.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/ims/internal/uce/presence/PresSipResponse.java
MIT
public int describeContents() { return 0; }
Constructor for the PresSipResponse class. @hide @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) public PresSipResponse(){}; /** @hide
PresSipResponse::describeContents
java
Reginer/aosp-android-jar
android-34/src/com/android/ims/internal/uce/presence/PresSipResponse.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/ims/internal/uce/presence/PresSipResponse.java
MIT
public void writeToParcel(Parcel dest, int flags) { dest.writeInt(mRequestId); dest.writeInt(mSipResponseCode); dest.writeString(mReasonPhrase); dest.writeParcelable(mCmdId, flags); dest.writeInt(mRetryAfter); dest.writeString(mReasonHeader); }
Constructor for the PresSipResponse class. @hide @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) public PresSipResponse(){}; /** @hide public int describeContents() { return 0; } /** @hide
PresSipResponse::writeToParcel
java
Reginer/aosp-android-jar
android-34/src/com/android/ims/internal/uce/presence/PresSipResponse.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/ims/internal/uce/presence/PresSipResponse.java
MIT
private PresSipResponse(Parcel source) { readFromParcel(source); }
Constructor for the PresSipResponse class. @hide @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) public PresSipResponse(){}; /** @hide public int describeContents() { return 0; } /** @hide public void writeToParcel(Parcel dest, int flags) { dest.writeInt(mRequestId); dest.writeInt(mSipResponseCode); dest.writeString(mReasonPhrase); dest.writeParcelable(mCmdId, flags); dest.writeInt(mRetryAfter); dest.writeString(mReasonHeader); } /** @hide public static final Parcelable.Creator<PresSipResponse> CREATOR = new Parcelable.Creator<PresSipResponse>() { public PresSipResponse createFromParcel(Parcel source) { return new PresSipResponse(source); } public PresSipResponse[] newArray(int size) { return new PresSipResponse[size]; } }; /** @hide
PresSipResponse::PresSipResponse
java
Reginer/aosp-android-jar
android-34/src/com/android/ims/internal/uce/presence/PresSipResponse.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/ims/internal/uce/presence/PresSipResponse.java
MIT
public void readFromParcel(Parcel source) { mRequestId = source.readInt(); mSipResponseCode = source.readInt(); mReasonPhrase = source.readString(); mCmdId = source.readParcelable(PresCmdId.class.getClassLoader(), com.android.ims.internal.uce.presence.PresCmdId.class); mRetryAfter = source.readInt(); mReasonHeader = source.readString(); }
Constructor for the PresSipResponse class. @hide @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) public PresSipResponse(){}; /** @hide public int describeContents() { return 0; } /** @hide public void writeToParcel(Parcel dest, int flags) { dest.writeInt(mRequestId); dest.writeInt(mSipResponseCode); dest.writeString(mReasonPhrase); dest.writeParcelable(mCmdId, flags); dest.writeInt(mRetryAfter); dest.writeString(mReasonHeader); } /** @hide public static final Parcelable.Creator<PresSipResponse> CREATOR = new Parcelable.Creator<PresSipResponse>() { public PresSipResponse createFromParcel(Parcel source) { return new PresSipResponse(source); } public PresSipResponse[] newArray(int size) { return new PresSipResponse[size]; } }; /** @hide private PresSipResponse(Parcel source) { readFromParcel(source); } /** @hide
PresSipResponse::readFromParcel
java
Reginer/aosp-android-jar
android-34/src/com/android/ims/internal/uce/presence/PresSipResponse.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/ims/internal/uce/presence/PresSipResponse.java
MIT
public ECParameterSpec getParams() { return spec; }
return the domain parameters for the curve
ECKeySpec::getParams
java
Reginer/aosp-android-jar
android-34/src/com/android/org/bouncycastle/jce/spec/ECKeySpec.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/org/bouncycastle/jce/spec/ECKeySpec.java
MIT
public byte[] getBytes(int numBytes) throws IOException, GeneralSecurityException { FileInputStream fis = null; try { fis = new FileInputStream("/dev/urandom"); byte[] bytes = new byte[numBytes]; if (bytes.length != fis.read(bytes)) { throw new GeneralSecurityException("Not enough random data available"); } return bytes; } finally { if (fis != null) { fis.close(); } } }
Polls random data to generate the array. @param numBytes Length of the array to generate. @return byte[] containing randomly generated data.
ByteArrayGenerator::getBytes
java
Reginer/aosp-android-jar
android-34/src/org/chromium/base/ByteArrayGenerator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/chromium/base/ByteArrayGenerator.java
MIT
public boolean isSameTrustConfiguration(String hostname1, String hostname2) { return mConfig.getConfigForHostname(hostname1) .equals(mConfig.getConfigForHostname(hostname2)); }
Returns {@code true} if this trust manager uses the same trust configuration for the provided hostnames. <p>This is required by android.net.http.X509TrustManagerExtensions.
RootTrustManager::isSameTrustConfiguration
java
Reginer/aosp-android-jar
android-33/src/android/security/net/config/RootTrustManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/security/net/config/RootTrustManager.java
MIT
public X509V1CertImpl() { }
Default constructor.
X509V1CertImpl::X509V1CertImpl
java
Reginer/aosp-android-jar
android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
MIT
public X509V1CertImpl(byte[] certData) throws CertificateException { try { ByteArrayInputStream bs; bs = new ByteArrayInputStream(certData); wrappedCert = (java.security.cert.X509Certificate) getFactory().generateCertificate(bs); } catch (java.security.cert.CertificateException e) { throw new CertificateException(e.getMessage()); } }
Unmarshals a certificate from its encoded form, parsing the encoded bytes. This form of constructor is used by agents which need to examine and use certificate contents. That is, this is one of the more commonly used constructors. Note that the buffer must include only a certificate, and no "garbage" may be left at the end. If you need to ignore data at the end of a certificate, use another constructor. @param certData the encoded bytes, with no trailing padding. @exception CertificateException on parsing errors.
X509V1CertImpl::X509V1CertImpl
java
Reginer/aosp-android-jar
android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
MIT
public X509V1CertImpl(InputStream in) throws CertificateException { try { wrappedCert = (java.security.cert.X509Certificate) getFactory().generateCertificate(in); } catch (java.security.cert.CertificateException e) { throw new CertificateException(e.getMessage()); } }
unmarshals an X.509 certificate from an input stream. @param in an input stream holding at least one certificate @exception CertificateException on parsing errors.
X509V1CertImpl::X509V1CertImpl
java
Reginer/aosp-android-jar
android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
MIT
public byte[] getEncoded() throws CertificateEncodingException { try { return wrappedCert.getEncoded(); } catch (java.security.cert.CertificateEncodingException e) { throw new CertificateEncodingException(e.getMessage()); } }
Returns the encoded form of this certificate. It is assumed that each certificate type would have only a single form of encoding; for example, X.509 certificates would be encoded as ASN.1 DER.
X509V1CertImpl::getEncoded
java
Reginer/aosp-android-jar
android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
MIT
public void verify(PublicKey key) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException { try { wrappedCert.verify(key); } catch (java.security.cert.CertificateException e) { throw new CertificateException(e.getMessage()); } }
Throws an exception if the certificate was not signed using the verification key provided. Successfully verifying a certificate does <em>not</em> indicate that one should trust the entity which it represents. @param key the public key used for verification.
X509V1CertImpl::verify
java
Reginer/aosp-android-jar
android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
MIT
public void verify(PublicKey key, String sigProvider) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException { try { wrappedCert.verify(key, sigProvider); } catch (java.security.cert.CertificateException e) { throw new CertificateException(e.getMessage()); } }
Throws an exception if the certificate was not signed using the verification key provided. Successfully verifying a certificate does <em>not</em> indicate that one should trust the entity which it represents. @param key the public key used for verification. @param sigProvider the name of the provider.
X509V1CertImpl::verify
java
Reginer/aosp-android-jar
android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
MIT
public void checkValidity() throws CertificateExpiredException, CertificateNotYetValidException { checkValidity(new Date()); }
Checks that the certificate is currently valid, i.e. the current time is within the specified validity period.
X509V1CertImpl::checkValidity
java
Reginer/aosp-android-jar
android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
MIT
public void checkValidity(Date date) throws CertificateExpiredException, CertificateNotYetValidException { try { wrappedCert.checkValidity(date); } catch (java.security.cert.CertificateNotYetValidException e) { throw new CertificateNotYetValidException(e.getMessage()); } catch (java.security.cert.CertificateExpiredException e) { throw new CertificateExpiredException(e.getMessage()); } }
Checks that the specified date is within the certificate's validity period, or basically if the certificate would be valid at the specified date/time. @param date the Date to check against to see if this certificate is valid at that date/time.
X509V1CertImpl::checkValidity
java
Reginer/aosp-android-jar
android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
MIT
public String toString() { return wrappedCert.toString(); }
Returns a printable representation of the certificate. This does not contain all the information available to distinguish this from any other certificate. The certificate must be fully constructed before this function may be called.
X509V1CertImpl::toString
java
Reginer/aosp-android-jar
android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
MIT
public PublicKey getPublicKey() { PublicKey key = wrappedCert.getPublicKey(); return key; }
Gets the publickey from this certificate. @return the publickey.
X509V1CertImpl::getPublicKey
java
Reginer/aosp-android-jar
android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
MIT
public int getVersion() { return wrappedCert.getVersion() - 1; }
Gets the publickey from this certificate. @return the publickey. public PublicKey getPublicKey() { PublicKey key = wrappedCert.getPublicKey(); return key; } /* Gets the version number from the certificate. @return the version number.
X509V1CertImpl::getVersion
java
Reginer/aosp-android-jar
android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
MIT
public BigInteger getSerialNumber() { return wrappedCert.getSerialNumber(); }
Gets the serial number from the certificate. @return the serial number.
X509V1CertImpl::getSerialNumber
java
Reginer/aosp-android-jar
android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
MIT
public Principal getSubjectDN() { return wrappedCert.getSubjectDN(); }
Gets the subject distinguished name from the certificate. @return the subject name. @exception CertificateException if a parsing error occurs.
X509V1CertImpl::getSubjectDN
java
Reginer/aosp-android-jar
android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
MIT
public Principal getIssuerDN() { return wrappedCert.getIssuerDN(); }
Gets the issuer distinguished name from the certificate. @return the issuer name. @exception CertificateException if a parsing error occurs.
X509V1CertImpl::getIssuerDN
java
Reginer/aosp-android-jar
android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
MIT
public Date getNotBefore() { return wrappedCert.getNotBefore(); }
Gets the notBefore date from the validity period of the certificate. @return the start date of the validity period. @exception CertificateException if a parsing error occurs.
X509V1CertImpl::getNotBefore
java
Reginer/aosp-android-jar
android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
MIT
public Date getNotAfter() { return wrappedCert.getNotAfter(); }
Gets the notAfter date from the validity period of the certificate. @return the end date of the validity period. @exception CertificateException if a parsing error occurs.
X509V1CertImpl::getNotAfter
java
Reginer/aosp-android-jar
android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
MIT
public String getSigAlgName() { return wrappedCert.getSigAlgName(); }
Gets the signature algorithm name for the certificate signature algorithm. For example, the string "SHA1/DSA". @return the signature algorithm name. @exception CertificateException if a parsing error occurs.
X509V1CertImpl::getSigAlgName
java
Reginer/aosp-android-jar
android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
MIT
public String getSigAlgOID() { return wrappedCert.getSigAlgOID(); }
Gets the signature algorithm OID string from the certificate. For example, the string "1.2.840.10040.4.3" @return the signature algorithm oid string. @exception CertificateException if a parsing error occurs.
X509V1CertImpl::getSigAlgOID
java
Reginer/aosp-android-jar
android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
MIT
public byte[] getSigAlgParams() { return wrappedCert.getSigAlgParams(); }
Gets the DER encoded signature algorithm parameters from this certificate's signature algorithm. @return the DER encoded signature algorithm parameters, or null if no parameters are present. @exception CertificateException if a parsing error occurs.
X509V1CertImpl::getSigAlgParams
java
Reginer/aosp-android-jar
android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java
MIT
public WindowContainerToken(IWindowContainerToken realToken) { mRealToken = realToken; }
Interface for a window container to communicate with the window manager. This also acts as a token. @hide @TestApi public final class WindowContainerToken implements Parcelable { private final IWindowContainerToken mRealToken; /** @hide
WindowContainerToken::WindowContainerToken
java
Reginer/aosp-android-jar
android-33/src/android/window/WindowContainerToken.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/window/WindowContainerToken.java
MIT
public IBinder asBinder() { return mRealToken.asBinder(); }
Interface for a window container to communicate with the window manager. This also acts as a token. @hide @TestApi public final class WindowContainerToken implements Parcelable { private final IWindowContainerToken mRealToken; /** @hide public WindowContainerToken(IWindowContainerToken realToken) { mRealToken = realToken; } private WindowContainerToken(Parcel in) { mRealToken = IWindowContainerToken.Stub.asInterface(in.readStrongBinder()); } /** @hide
WindowContainerToken::asBinder
java
Reginer/aosp-android-jar
android-33/src/android/window/WindowContainerToken.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/window/WindowContainerToken.java
MIT
public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeStrongBinder(mRealToken.asBinder()); }
Interface for a window container to communicate with the window manager. This also acts as a token. @hide @TestApi public final class WindowContainerToken implements Parcelable { private final IWindowContainerToken mRealToken; /** @hide public WindowContainerToken(IWindowContainerToken realToken) { mRealToken = realToken; } private WindowContainerToken(Parcel in) { mRealToken = IWindowContainerToken.Stub.asInterface(in.readStrongBinder()); } /** @hide public IBinder asBinder() { return mRealToken.asBinder(); } @Override /** @hide
WindowContainerToken::writeToParcel
java
Reginer/aosp-android-jar
android-33/src/android/window/WindowContainerToken.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/window/WindowContainerToken.java
MIT
public int describeContents() { return 0; }
Interface for a window container to communicate with the window manager. This also acts as a token. @hide @TestApi public final class WindowContainerToken implements Parcelable { private final IWindowContainerToken mRealToken; /** @hide public WindowContainerToken(IWindowContainerToken realToken) { mRealToken = realToken; } private WindowContainerToken(Parcel in) { mRealToken = IWindowContainerToken.Stub.asInterface(in.readStrongBinder()); } /** @hide public IBinder asBinder() { return mRealToken.asBinder(); } @Override /** @hide public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeStrongBinder(mRealToken.asBinder()); } @NonNull public static final Creator<WindowContainerToken> CREATOR = new Creator<WindowContainerToken>() { @Override public WindowContainerToken createFromParcel(Parcel in) { return new WindowContainerToken(in); } @Override public WindowContainerToken[] newArray(int size) { return new WindowContainerToken[size]; } }; @Override /** @hide
WindowContainerToken::describeContents
java
Reginer/aosp-android-jar
android-33/src/android/window/WindowContainerToken.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/window/WindowContainerToken.java
MIT
public final CallerIdentity getIdentity() { return mIdentity; }
Returns the listener identity.
RemoteListenerRegistration::getIdentity
java
Reginer/aosp-android-jar
android-33/src/com/android/server/location/listeners/RemoteListenerRegistration.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/location/listeners/RemoteListenerRegistration.java
MIT
protected URLConnection openConnection(URL u, Proxy p) throws IOException { throw new UnsupportedOperationException("Method not implemented."); }
Same as openConnection(URL), except that the connection will be made through the specified proxy; Protocol handlers that do not support proxying will ignore the proxy parameter and make a normal connection. Calling this method preempts the system's default ProxySelector settings. @param u the URL that this connects to. @param p the proxy through which the connection will be made. If direct connection is desired, Proxy.NO_PROXY should be specified. @return a {@code URLConnection} object for the {@code URL}. @exception IOException if an I/O error occurs while opening the connection. @exception IllegalArgumentException if either u or p is null, or p has the wrong type. @exception UnsupportedOperationException if the subclass that implements the protocol doesn't support this method. @since 1.5
URLStreamHandler::openConnection
java
Reginer/aosp-android-jar
android-32/src/java/net/URLStreamHandler.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/net/URLStreamHandler.java
MIT
protected void parseURL(URL u, String spec, int start, int limit) { // These fields may receive context content if this was relative URL String protocol = u.getProtocol(); String authority = u.getAuthority(); String userInfo = u.getUserInfo(); String host = u.getHost(); int port = u.getPort(); String path = u.getPath(); String query = u.getQuery(); // This field has already been parsed String ref = u.getRef(); boolean isRelPath = false; boolean queryOnly = false; // BEGIN Android-changed: App compat. boolean querySet = false; // END Android-changed: App compat. // FIX: should not assume query if opaque // Strip off the query part if (start < limit) { int queryStart = spec.indexOf('?'); queryOnly = queryStart == start; if ((queryStart != -1) && (queryStart < limit)) { query = spec.substring(queryStart+1, limit); if (limit > queryStart) limit = queryStart; spec = spec.substring(0, queryStart); // BEGIN Android-changed: App compat. querySet = true; // END Android-changed: App compat. } } int i = 0; // Parse the authority part if any // BEGIN Android-changed: App compat. // boolean isUNCName = (start <= limit - 4) && // (spec.charAt(start) == '/') && // (spec.charAt(start + 1) == '/') && // (spec.charAt(start + 2) == '/') && // (spec.charAt(start + 3) == '/'); boolean isUNCName = false; // END Android-changed: App compat. if (!isUNCName && (start <= limit - 2) && (spec.charAt(start) == '/') && (spec.charAt(start + 1) == '/')) { start += 2; // BEGIN Android-changed: Check for all hostname termination chars. http://b/110955991 /* i = spec.indexOf('/', start); if (i < 0 || i > limit) { i = spec.indexOf('?', start); if (i < 0 || i > limit) i = limit; } */ LOOP: for (i = start; i < limit; i++) { switch (spec.charAt(i)) { case '/': // Start of path case '\\': // Start of path - see https://url.spec.whatwg.org/#host-state case '?': // Start of query case '#': // Start of fragment break LOOP; } } // END Android-changed: Check for all hostname termination chars. http://b/110955991 host = authority = spec.substring(start, i); int ind = authority.indexOf('@'); if (ind != -1) { if (ind != authority.lastIndexOf('@')) { // more than one '@' in authority. This is not server based userInfo = null; host = null; } else { userInfo = authority.substring(0, ind); host = authority.substring(ind+1); } } else { userInfo = null; } if (host != null) { // If the host is surrounded by [ and ] then its an IPv6 // literal address as specified in RFC2732 if (host.length()>0 && (host.charAt(0) == '[')) { if ((ind = host.indexOf(']')) > 2) { String nhost = host ; host = nhost.substring(0,ind+1); if (!IPAddressUtil. isIPv6LiteralAddress(host.substring(1, ind))) { throw new IllegalArgumentException( "Invalid host: "+ host); } port = -1 ; if (nhost.length() > ind+1) { if (nhost.charAt(ind+1) == ':') { ++ind ; // port can be null according to RFC2396 if (nhost.length() > (ind + 1)) { port = Integer.parseInt(nhost.substring(ind+1)); } } else { throw new IllegalArgumentException( "Invalid authority field: " + authority); } } } else { throw new IllegalArgumentException( "Invalid authority field: " + authority); } } else { ind = host.indexOf(':'); port = -1; if (ind >= 0) { // port can be null according to RFC2396 if (host.length() > (ind + 1)) { // BEGIN Android-changed: App compat. // port = Integer.parseInt(host.substring(ind + 1)); char firstPortChar = host.charAt(ind+1); if (firstPortChar >= '0' && firstPortChar <= '9') { port = Integer.parseInt(host.substring(ind + 1)); } else { throw new IllegalArgumentException("invalid port: " + host.substring(ind + 1)); } // END Android-changed: App compat. } host = host.substring(0, ind); } } } else { host = ""; } if (port < -1) throw new IllegalArgumentException("Invalid port number :" + port); start = i; // If the authority is defined then the path is defined by the // spec only; See RFC 2396 Section 5.2.4. // BEGIN Android-changed: App compat. // if (authority != null && authority.length() > 0) // path = ""; path = null; if (!querySet) { query = null; } // END Android-changed: App compat. } if (host == null) { host = ""; } // Parse the file path if any if (start < limit) { // Android-changed: Check for all hostname termination chars. http://b/110955991 // if (spec.charAt(start) == '/') { if (spec.charAt(start) == '/' || spec.charAt(start) == '\\') { path = spec.substring(start, limit); } else if (path != null && path.length() > 0) { isRelPath = true; int ind = path.lastIndexOf('/'); String seperator = ""; if (ind == -1 && authority != null) seperator = "/"; path = path.substring(0, ind + 1) + seperator + spec.substring(start, limit); } else { String seperator = (authority != null) ? "/" : ""; path = seperator + spec.substring(start, limit); } } // BEGIN Android-changed: App compat. //else if (queryOnly && path != null) { // int ind = path.lastIndexOf('/'); // if (ind < 0) // ind = 0; // path = path.substring(0, ind) + "/"; //} // END Android-changed: App compat. if (path == null) path = ""; // BEGIN Android-changed: always assume isRelPath is true. //if (isRelPath) { if (true) { // END Android-changed: always assume isRelPath is true. // Remove embedded /./ while ((i = path.indexOf("/./")) >= 0) { path = path.substring(0, i) + path.substring(i + 2); } // Remove embedded /../ if possible i = 0; while ((i = path.indexOf("/../", i)) >= 0) { // BEGIN Android-changed: App compat. /* * Trailing /../ */ if (i == 0) { path = path.substring(i + 3); i = 0; // END Android-changed: App compat. /* * A "/../" will cancel the previous segment and itself, * unless that segment is a "/../" itself * i.e. "/a/b/../c" becomes "/a/c" * but "/../../a" should stay unchanged */ // Android-changed: App compat. // if (i > 0 && (limit = path.lastIndexOf('/', i - 1)) >= 0 && } else if (i > 0 && (limit = path.lastIndexOf('/', i - 1)) >= 0 && (path.indexOf("/../", limit) != 0)) { path = path.substring(0, limit) + path.substring(i + 3); i = 0; } else { i = i + 3; } } // Remove trailing .. if possible while (path.endsWith("/..")) { i = path.indexOf("/.."); if ((limit = path.lastIndexOf('/', i - 1)) >= 0) { path = path.substring(0, limit+1); } else { break; } } // Remove starting . if (path.startsWith("./") && path.length() > 2) path = path.substring(2); // Remove trailing . if (path.endsWith("/.")) path = path.substring(0, path.length() -1); // Android-changed: App compat: Remove trailing '?'. if (path.endsWith("?")) path = path.substring(0, path.length() -1); } setURL(u, protocol, host, port, authority, userInfo, path, query, ref); }
Parses the string representation of a {@code URL} into a {@code URL} object. <p> If there is any inherited context, then it has already been copied into the {@code URL} argument. <p> The {@code parseURL} method of {@code URLStreamHandler} parses the string representation as if it were an {@code http} specification. Most URL protocol families have a similar parsing. A stream protocol handler for a protocol that has a different syntax must override this routine. @param u the {@code URL} to receive the result of parsing the spec. @param spec the {@code String} representing the URL that must be parsed. @param start the character index at which to begin parsing. This is just past the '{@code :}' (if there is one) that specifies the determination of the protocol name. @param limit the character position to stop parsing at. This is the end of the string or the position of the "{@code #}" character, if present. All information after the sharp sign indicates an anchor.
URLStreamHandler::parseURL
java
Reginer/aosp-android-jar
android-32/src/java/net/URLStreamHandler.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/net/URLStreamHandler.java
MIT
protected int getDefaultPort() { return -1; }
Returns the default port for a URL parsed by this handler. This method is meant to be overidden by handlers with default port numbers. @return the default port for a {@code URL} parsed by this handler. @since 1.3
URLStreamHandler::getDefaultPort
java
Reginer/aosp-android-jar
android-32/src/java/net/URLStreamHandler.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/net/URLStreamHandler.java
MIT
protected boolean equals(URL u1, URL u2) { // Android-changed: Avoid network I/O. return Objects.equals(u1.getRef(), u2.getRef()) && Objects.equals(u1.getQuery(), u2.getQuery()) && // sameFile compares the protocol, file, port & host components of // the URLs. sameFile(u1, u2); }
Provides the default equals calculation. May be overidden by handlers for other protocols that have different requirements for equals(). This method requires that none of its arguments is null. This is guaranteed by the fact that it is only called by java.net.URL class. @param u1 a URL object @param u2 a URL object @return {@code true} if the two urls are considered equal, ie. they refer to the same fragment in the same file. @since 1.3
URLStreamHandler::equals
java
Reginer/aosp-android-jar
android-32/src/java/net/URLStreamHandler.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/net/URLStreamHandler.java
MIT
protected int hashCode(URL u) { // Android-changed: Avoid network I/O. // Hash on the same set of fields that we compare in equals(). return Objects.hash( u.getRef(), u.getQuery(), u.getProtocol(), u.getFile(), u.getHost(), u.getPort()); }
Provides the default hash calculation. May be overidden by handlers for other protocols that have different requirements for hashCode calculation. @param u a URL object @return an {@code int} suitable for hash table indexing @since 1.3
URLStreamHandler::hashCode
java
Reginer/aosp-android-jar
android-32/src/java/net/URLStreamHandler.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/net/URLStreamHandler.java
MIT
protected boolean sameFile(URL u1, URL u2) { // Compare the protocols. if (!((u1.getProtocol() == u2.getProtocol()) || (u1.getProtocol() != null && u1.getProtocol().equalsIgnoreCase(u2.getProtocol())))) return false; // Compare the files. if (!(u1.getFile() == u2.getFile() || (u1.getFile() != null && u1.getFile().equals(u2.getFile())))) return false; // Compare the ports. int port1, port2; port1 = (u1.getPort() != -1) ? u1.getPort() : u1.handler.getDefaultPort(); port2 = (u2.getPort() != -1) ? u2.getPort() : u2.handler.getDefaultPort(); if (port1 != port2) return false; // Compare the hosts. if (!hostsEqual(u1, u2)) return false; return true; }
Compare two urls to see whether they refer to the same file, i.e., having the same protocol, host, port, and path. This method requires that none of its arguments is null. This is guaranteed by the fact that it is only called indirectly by java.net.URL class. @param u1 a URL object @param u2 a URL object @return true if u1 and u2 refer to the same file @since 1.3
URLStreamHandler::sameFile
java
Reginer/aosp-android-jar
android-32/src/java/net/URLStreamHandler.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/net/URLStreamHandler.java
MIT
protected synchronized InetAddress getHostAddress(URL u) { if (u.hostAddress != null) return u.hostAddress; String host = u.getHost(); if (host == null || host.equals("")) { return null; } else { try { u.hostAddress = InetAddress.getByName(host); } catch (UnknownHostException ex) { return null; } catch (SecurityException se) { return null; } } return u.hostAddress; }
Get the IP address of our host. An empty host field or a DNS failure will result in a null return. @param u a URL object @return an {@code InetAddress} representing the host IP address. @since 1.3
URLStreamHandler::getHostAddress
java
Reginer/aosp-android-jar
android-32/src/java/net/URLStreamHandler.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/net/URLStreamHandler.java
MIT
protected boolean hostsEqual(URL u1, URL u2) { // Android-changed: Don't compare the InetAddresses of the hosts. if (u1.getHost() != null && u2.getHost() != null) return u1.getHost().equalsIgnoreCase(u2.getHost()); else return u1.getHost() == null && u2.getHost() == null; }
Compares the host components of two URLs. @param u1 the URL of the first host to compare @param u2 the URL of the second host to compare @return {@code true} if and only if they are equal, {@code false} otherwise. @since 1.3
URLStreamHandler::hostsEqual
java
Reginer/aosp-android-jar
android-32/src/java/net/URLStreamHandler.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/net/URLStreamHandler.java
MIT
protected String toExternalForm(URL u) { // pre-compute length of StringBuffer int len = u.getProtocol().length() + 1; if (u.getAuthority() != null && u.getAuthority().length() > 0) len += 2 + u.getAuthority().length(); if (u.getPath() != null) { len += u.getPath().length(); } if (u.getQuery() != null) { len += 1 + u.getQuery().length(); } if (u.getRef() != null) len += 1 + u.getRef().length(); // BEGIN Android-changed: New toExternalForm variant that optionally escapes illegal chars. // TODO: The variant has been removed. We can potentially revert the change StringBuilder result = new StringBuilder(len); result.append(u.getProtocol()); result.append(":"); if (u.getAuthority() != null) {// ANDROID: && u.getAuthority().length() > 0) { result.append("//"); result.append(u.getAuthority()); } String fileAndQuery = u.getFile(); if (fileAndQuery != null) { result.append(fileAndQuery); } // END Android-changed: New toExternalForm variant that optionally escapes illegal chars. if (u.getRef() != null) { result.append("#"); result.append(u.getRef()); } return result.toString(); }
Converts a {@code URL} of a specific protocol to a {@code String}. @param u the URL. @return a string representation of the {@code URL} argument.
URLStreamHandler::toExternalForm
java
Reginer/aosp-android-jar
android-32/src/java/net/URLStreamHandler.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/net/URLStreamHandler.java
MIT
protected void setURL(URL u, String protocol, String host, int port, String authority, String userInfo, String path, String query, String ref) { if (this != u.handler) { throw new SecurityException("handler for url different from " + "this handler"); } // ensure that no one can reset the protocol on a given URL. u.set(u.getProtocol(), host, port, authority, userInfo, path, query, ref); }
Sets the fields of the {@code URL} argument to the indicated values. Only classes derived from URLStreamHandler are able to use this method to set the values of the URL fields. @param u the URL to modify. @param protocol the protocol name. @param host the remote host value for the URL. @param port the port on the remote machine. @param authority the authority part for the URL. @param userInfo the userInfo part of the URL. @param path the path component of the URL. @param query the query part for the URL. @param ref the reference. @exception SecurityException if the protocol handler of the URL is different from this one @since 1.3
URLStreamHandler::setURL
java
Reginer/aosp-android-jar
android-32/src/java/net/URLStreamHandler.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/net/URLStreamHandler.java
MIT
BluetoothPbapClient(Context context, BluetoothAdapter adapter) { if (DBG) { Log.d(TAG, "Create BluetoothPbapClient proxy object"); } mAdapter = adapter; mAttributionSource = adapter.getAttributionSource(); mService = null; mCloseGuard = new CloseGuard(); mCloseGuard.open("close"); }
Create a BluetoothPbapClient proxy object. @hide
BluetoothPbapClient::BluetoothPbapClient
java
Reginer/aosp-android-jar
android-35/src/android/bluetooth/BluetoothPbapClient.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/bluetooth/BluetoothPbapClient.java
MIT
public LocalSocket() { this(SOCKET_STREAM); }
Creates a AF_LOCAL/UNIX domain stream socket.
LocalSocket::LocalSocket
java
Reginer/aosp-android-jar
android-33/src/android/net/LocalSocket.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/net/LocalSocket.java
MIT
public LocalSocket(int sockType) { this(new LocalSocketImpl(), sockType); }
Creates a AF_LOCAL/UNIX domain stream socket with given socket type @param sockType either {@link #SOCKET_DGRAM}, {@link #SOCKET_STREAM} or {@link #SOCKET_SEQPACKET}
LocalSocket::LocalSocket
java
Reginer/aosp-android-jar
android-33/src/android/net/LocalSocket.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/net/LocalSocket.java
MIT
static LocalSocket createLocalSocketForAccept(LocalSocketImpl impl) { LocalSocket socket = new LocalSocket(impl, SOCKET_UNKNOWN); socket.checkConnected(); return socket; }
for use with LocalServerSocket.accept()
LocalSocket::createLocalSocketForAccept
java
Reginer/aosp-android-jar
android-33/src/android/net/LocalSocket.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/net/LocalSocket.java
MIT
private void implCreateIfNeeded() throws IOException { if (!implCreated) { synchronized (this) { if (!implCreated) { try { impl.create(sockType); } finally { implCreated = true; } } } } }
It's difficult to discern from the spec when impl.create() should be called, but it seems like a reasonable rule is "as soon as possible, but not in a context where IOException cannot be thrown" @throws IOException from SocketImpl.create()
LocalSocket::implCreateIfNeeded
java
Reginer/aosp-android-jar
android-33/src/android/net/LocalSocket.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/net/LocalSocket.java
MIT
public void connect(LocalSocketAddress endpoint) throws IOException { synchronized (this) { if (isConnected) { throw new IOException("already connected"); } implCreateIfNeeded(); impl.connect(endpoint, 0); isConnected = true; isBound = true; } }
Connects this socket to an endpoint. May only be called on an instance that has not yet been connected. @param endpoint endpoint address @throws IOException if socket is in invalid state or the address does not exist.
LocalSocket::connect
java
Reginer/aosp-android-jar
android-33/src/android/net/LocalSocket.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/net/LocalSocket.java
MIT
public void bind(LocalSocketAddress bindpoint) throws IOException { implCreateIfNeeded(); synchronized (this) { if (isBound) { throw new IOException("already bound"); } localAddress = bindpoint; impl.bind(localAddress); isBound = true; } }
Binds this socket to an endpoint name. May only be called on an instance that has not yet been bound. @param bindpoint endpoint address @throws IOException
LocalSocket::bind
java
Reginer/aosp-android-jar
android-33/src/android/net/LocalSocket.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/net/LocalSocket.java
MIT
public LocalSocketAddress getLocalSocketAddress() { return localAddress; }
Retrieves the name that this socket is bound to, if any. @return Local address or null if anonymous
LocalSocket::getLocalSocketAddress
java
Reginer/aosp-android-jar
android-33/src/android/net/LocalSocket.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/net/LocalSocket.java
MIT
public InputStream getInputStream() throws IOException { implCreateIfNeeded(); return impl.getInputStream(); }
Retrieves the input stream for this instance. @return input stream @throws IOException if socket has been closed or cannot be created.
LocalSocket::getInputStream
java
Reginer/aosp-android-jar
android-33/src/android/net/LocalSocket.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/net/LocalSocket.java
MIT
public OutputStream getOutputStream() throws IOException { implCreateIfNeeded(); return impl.getOutputStream(); }
Retrieves the output stream for this instance. @return output stream @throws IOException if socket has been closed or cannot be created.
LocalSocket::getOutputStream
java
Reginer/aosp-android-jar
android-33/src/android/net/LocalSocket.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/net/LocalSocket.java
MIT
public void shutdownInput() throws IOException { implCreateIfNeeded(); impl.shutdownInput(); }
Shuts down the input side of the socket. @throws IOException
LocalSocket::shutdownInput
java
Reginer/aosp-android-jar
android-33/src/android/net/LocalSocket.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/net/LocalSocket.java
MIT
public void shutdownOutput() throws IOException { implCreateIfNeeded(); impl.shutdownOutput(); }
Shuts down the output side of the socket. @throws IOException
LocalSocket::shutdownOutput
java
Reginer/aosp-android-jar
android-33/src/android/net/LocalSocket.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/net/LocalSocket.java
MIT
public void setFileDescriptorsForSend(FileDescriptor[] fds) { impl.setFileDescriptorsForSend(fds); }
Enqueues a set of file descriptors to send to the peer. The queue is one deep. The file descriptors will be sent with the next write of normal data, and will be delivered in a single ancillary message. See "man 7 unix" SCM_RIGHTS on a desktop Linux machine. @param fds non-null; file descriptors to send.
LocalSocket::setFileDescriptorsForSend
java
Reginer/aosp-android-jar
android-33/src/android/net/LocalSocket.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/net/LocalSocket.java
MIT
public FileDescriptor[] getAncillaryFileDescriptors() throws IOException { return impl.getAncillaryFileDescriptors(); }
Retrieves a set of file descriptors that a peer has sent through an ancillary message. This method retrieves the most recent set sent, and then returns null until a new set arrives. File descriptors may only be passed along with regular data, so this method can only return a non-null after a read operation. @return null or file descriptor array @throws IOException
LocalSocket::getAncillaryFileDescriptors
java
Reginer/aosp-android-jar
android-33/src/android/net/LocalSocket.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/net/LocalSocket.java
MIT
public Credentials getPeerCredentials() throws IOException { return impl.getPeerCredentials(); }
Retrieves the credentials of this socket's peer. Only valid on connected sockets. @return non-null; peer credentials @throws IOException
LocalSocket::getPeerCredentials
java
Reginer/aosp-android-jar
android-33/src/android/net/LocalSocket.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/net/LocalSocket.java
MIT
public FileDescriptor getFileDescriptor() { return impl.getFileDescriptor(); }
Returns file descriptor or null if not yet open/already closed @return fd or null
LocalSocket::getFileDescriptor
java
Reginer/aosp-android-jar
android-33/src/android/net/LocalSocket.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/net/LocalSocket.java
MIT
static short getScaledLifetimePlc(int lifetime, int prefixLengthCode) { return (short) ((lifetime & 0xfff8) | (prefixLengthCode & 0x7)); }
Returns the 2-byte "scaled lifetime and prefix length code" field: 13-bit lifetime, 3-bit PLC
getSimpleName::getScaledLifetimePlc
java
Reginer/aosp-android-jar
android-34/src/com/android/net/module/util/netlink/StructNdOptPref64.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/net/module/util/netlink/StructNdOptPref64.java
MIT
public static StructNdOptPref64 parse(@NonNull ByteBuffer buf) { if (buf.remaining() < STRUCT_SIZE) return null; try { return new StructNdOptPref64(buf); } catch (IllegalArgumentException e) { // Not great, but better than throwing an exception that might crash the caller. // Convention in this package is that null indicates that the option was truncated, so // callers must already handle it. Log.d(TAG, "Invalid PREF64 option: " + e); return null; } }
Parses an option from a {@link ByteBuffer}. @param buf The buffer from which to parse the option. The buffer's byte order must be {@link java.nio.ByteOrder#BIG_ENDIAN}. @return the parsed option, or {@code null} if the option could not be parsed successfully (for example, if it was truncated, or if the prefix length code was wrong).
getSimpleName::parse
java
Reginer/aosp-android-jar
android-34/src/com/android/net/module/util/netlink/StructNdOptPref64.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/net/module/util/netlink/StructNdOptPref64.java
MIT
public ByteBuffer toByteBuffer() { ByteBuffer buf = ByteBuffer.allocate(STRUCT_SIZE); writeToByteBuffer(buf); buf.flip(); return buf; }
Parses an option from a {@link ByteBuffer}. @param buf The buffer from which to parse the option. The buffer's byte order must be {@link java.nio.ByteOrder#BIG_ENDIAN}. @return the parsed option, or {@code null} if the option could not be parsed successfully (for example, if it was truncated, or if the prefix length code was wrong). public static StructNdOptPref64 parse(@NonNull ByteBuffer buf) { if (buf.remaining() < STRUCT_SIZE) return null; try { return new StructNdOptPref64(buf); } catch (IllegalArgumentException e) { // Not great, but better than throwing an exception that might crash the caller. // Convention in this package is that null indicates that the option was truncated, so // callers must already handle it. Log.d(TAG, "Invalid PREF64 option: " + e); return null; } } protected void writeToByteBuffer(ByteBuffer buf) { super.writeToByteBuffer(buf); buf.putShort(getScaledLifetimePlc(lifetime, prefixLengthToPlc(prefix.getPrefixLength()))); buf.put(prefix.getRawAddress(), 0, 12); } /** Outputs the wire format of the option to a new big-endian ByteBuffer.
getSimpleName::toByteBuffer
java
Reginer/aosp-android-jar
android-34/src/com/android/net/module/util/netlink/StructNdOptPref64.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/net/module/util/netlink/StructNdOptPref64.java
MIT
default void onSystemError(@Nullable Throwable throwable) { throw new RuntimeException("Unrecoverable system error", throwable); }
Called when a system error occurs. <p>This method is only called the infrastructure is fundamentally broken or unavailable, such that none of the requests could be started. For example, it will be called if the AppSearch service unexpectedly fails to initialize and can't be recovered by any means, or if communicating to the server over Binder fails (e.g. system service crashed or device is rebooting). <p>The error is not expected to be recoverable and there is no specific recommended action other than displaying a permanent message to the user. <p>Normal errors that are caused by invalid inputs or recoverable/retriable situations are reported associated with the input that caused them via the {@link #onResult} method. @param throwable an exception describing the system error
onSystemError
java
Reginer/aosp-android-jar
android-34/src/android/app/appsearch/BatchResultCallback.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/appsearch/BatchResultCallback.java
MIT
public static boolean checkDumpPermission(Context context, String tag, PrintWriter pw) { if (context.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) != PackageManager.PERMISSION_GRANTED) { pw.println("Permission Denial: can't dump " + tag + " from from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid() + " due to missing android.permission.DUMP permission"); return false; } else { return true; } }
Verify that caller holds {@link android.Manifest.permission#DUMP}.
MediaServerUtils::checkDumpPermission
java
Reginer/aosp-android-jar
android-33/src/com/android/server/media/MediaServerUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/media/MediaServerUtils.java
MIT
public BackupRestoreEventLogger getLogger() { return mLogger; }
Gets the logger so that the backuphelper can log success/error for each datatype handled
BackupHelperWithLogger::getLogger
java
Reginer/aosp-android-jar
android-35/src/android/app/backup/BackupHelperWithLogger.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/app/backup/BackupHelperWithLogger.java
MIT
public void setLogger(BackupRestoreEventLogger logger) { mLogger = logger; mIsLoggerSet = true; }
Allow the shared backup agent to pass a logger to each of its backup helper
BackupHelperWithLogger::setLogger
java
Reginer/aosp-android-jar
android-35/src/android/app/backup/BackupHelperWithLogger.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/app/backup/BackupHelperWithLogger.java
MIT
public boolean isLoggerSet() { return mIsLoggerSet; }
Allow the helper to check if its shared backup agent has passed a logger
BackupHelperWithLogger::isLoggerSet
java
Reginer/aosp-android-jar
android-35/src/android/app/backup/BackupHelperWithLogger.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/app/backup/BackupHelperWithLogger.java
MIT
private void flush(boolean completely) { int length = builder.length(); int start = 0; int nextBreak; // Log one line for each line break. while (start < length && (nextBreak = builder.indexOf("\n", start)) != -1) { log(builder.substring(start, nextBreak)); start = nextBreak + 1; } if (completely) { // Log the remainder of the buffer. if (start < length) { log(builder.substring(start)); } builder.setLength(0); } else { // Delete characters leading up to the next starting point. builder.delete(0, start); } }
Searches buffer for line breaks and logs a message for each one. @param completely true if the ending chars should be treated as a line even though they don't end in a line break
LoggingPrintStream::flush
java
Reginer/aosp-android-jar
android-33/src/com/android/internal/os/LoggingPrintStream.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/os/LoggingPrintStream.java
MIT
public int startSession(PendingIntent incomingCallIntent, IImsRegistrationListener listener) { return 0; }
Notifies the MMTel feature that you would like to start a session. This should always be done before making/receiving IMS calls. The IMS service will register the device to the operator's network with the credentials (from ISIM) periodically in order to receive calls from the operator's network. When the IMS service receives a new call, it will send out an intent with the provided action string. The intent contains a call ID extra {@link IImsCallSession#getCallId} and it can be used to take a call. @param incomingCallIntent When an incoming call is received, the IMS service will call {@link PendingIntent#send} to send back the intent to the caller with ImsManager#INCOMING_CALL_RESULT_CODE as the result code and the intent to fill in the call ID; It cannot be null. @param listener To listen to IMS registration events; It cannot be null @return an integer (greater than 0) representing the session id associated with the session that has been started.
MMTelFeature::startSession
java
Reginer/aosp-android-jar
android-31/src/android/telephony/ims/compat/feature/MMTelFeature.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/ims/compat/feature/MMTelFeature.java
MIT
public void endSession(int sessionId) { }
End a previously started session using the associated sessionId. @param sessionId an integer (greater than 0) representing the ongoing session. See {@link #startSession}.
MMTelFeature::endSession
java
Reginer/aosp-android-jar
android-31/src/android/telephony/ims/compat/feature/MMTelFeature.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/ims/compat/feature/MMTelFeature.java
MIT
public boolean isConnected(int callSessionType, int callType) { return false; }
Checks if the IMS service has successfully registered to the IMS network with the specified service & call type. @param callSessionType a service type that is specified in {@link ImsCallProfile} {@link ImsCallProfile#SERVICE_TYPE_NORMAL} {@link ImsCallProfile#SERVICE_TYPE_EMERGENCY} @param callType a call type that is specified in {@link ImsCallProfile} {@link ImsCallProfile#CALL_TYPE_VOICE_N_VIDEO} {@link ImsCallProfile#CALL_TYPE_VOICE} {@link ImsCallProfile#CALL_TYPE_VT} {@link ImsCallProfile#CALL_TYPE_VS} @return true if the specified service id is connected to the IMS network; false otherwise
MMTelFeature::isConnected
java
Reginer/aosp-android-jar
android-31/src/android/telephony/ims/compat/feature/MMTelFeature.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/ims/compat/feature/MMTelFeature.java
MIT
public boolean isOpened() { return false; }
Checks if the specified IMS service is opened. @return true if the specified service id is opened; false otherwise
MMTelFeature::isOpened
java
Reginer/aosp-android-jar
android-31/src/android/telephony/ims/compat/feature/MMTelFeature.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/ims/compat/feature/MMTelFeature.java
MIT
public void addRegistrationListener(IImsRegistrationListener listener) { }
Add a new registration listener for the client associated with the session Id. @param listener An implementation of IImsRegistrationListener.
MMTelFeature::addRegistrationListener
java
Reginer/aosp-android-jar
android-31/src/android/telephony/ims/compat/feature/MMTelFeature.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/ims/compat/feature/MMTelFeature.java
MIT
public void removeRegistrationListener(IImsRegistrationListener listener) { }
Remove a previously registered listener using {@link #addRegistrationListener} for the client associated with the session Id. @param listener A previously registered IImsRegistrationListener
MMTelFeature::removeRegistrationListener
java
Reginer/aosp-android-jar
android-31/src/android/telephony/ims/compat/feature/MMTelFeature.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/ims/compat/feature/MMTelFeature.java
MIT
public ImsCallProfile createCallProfile(int sessionId, int callSessionType, int callType) { return null; }
Creates a {@link ImsCallProfile} from the service capabilities & IMS registration state. @param sessionId a session id which is obtained from {@link #startSession} @param callSessionType a service type that is specified in {@link ImsCallProfile} {@link ImsCallProfile#SERVICE_TYPE_NONE} {@link ImsCallProfile#SERVICE_TYPE_NORMAL} {@link ImsCallProfile#SERVICE_TYPE_EMERGENCY} @param callType a call type that is specified in {@link ImsCallProfile} {@link ImsCallProfile#CALL_TYPE_VOICE} {@link ImsCallProfile#CALL_TYPE_VT} {@link ImsCallProfile#CALL_TYPE_VT_TX} {@link ImsCallProfile#CALL_TYPE_VT_RX} {@link ImsCallProfile#CALL_TYPE_VT_NODIR} {@link ImsCallProfile#CALL_TYPE_VS} {@link ImsCallProfile#CALL_TYPE_VS_TX} {@link ImsCallProfile#CALL_TYPE_VS_RX} @return a {@link ImsCallProfile} object
MMTelFeature::createCallProfile
java
Reginer/aosp-android-jar
android-31/src/android/telephony/ims/compat/feature/MMTelFeature.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/ims/compat/feature/MMTelFeature.java
MIT