src/api-impl: fix up code style, mainly for code imported from AOSP

used the following (plus manual edits):
`clang-format --style="{BasedOnStyle: LLVM, IndentWidth: 8, UseTab: Always, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: true, ColumnLimit: 0}`
This commit is contained in:
Mis012
2023-06-22 11:45:46 +02:00
parent 824b821f5a
commit 0a9591c474
208 changed files with 154568 additions and 150150 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,4 @@
package android.os;
public class Binder extends IBinder {
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,6 @@
package android.os;
//import android.os.ICancellationSignal;
// import android.os.ICancellationSignal;
public final class CancellationSignal {
}

View File

@@ -1,15 +1,14 @@
package android.os;
public final class Debug
{
public static class MemoryInfo {
}
/**
* Wait until a debugger attaches. As soon as the debugger attaches,
* this returns, so you will need to place a breakpoint after the
* waitForDebugger() call if you want to start tracing immediately.
*/
public static class InstructionCount {
public InstructionCount() {
}
}
public final class Debug {
public static class MemoryInfo {
}
/**
* Wait until a debugger attaches. As soon as the debugger attaches,
* this returns, so you will need to place a breakpoint after the
* waitForDebugger() call if you want to start tracing immediately.
*/
public static class InstructionCount {
public InstructionCount() {
}
}
}

View File

@@ -17,12 +17,10 @@
package android.os;
import android.content.Context;
//import android.text.TextUtils;
// import android.text.TextUtils;
import android.util.Log;
//import com.android.internal.annotations.GuardedBy;
//import com.google.android.collect.Lists;
// import com.android.internal.annotations.GuardedBy;
// import com.google.android.collect.Lists;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -44,7 +42,9 @@ public class Environment {
private static final String ENV_SECONDARY_STORAGE = "SECONDARY_STORAGE";
private static final String ENV_ANDROID_ROOT = "ANDROID_ROOT";
/** {@hide} */
/**
* {@hide}
*/
public static final String DIR_ANDROID = "Android";
private static final String DIR_DATA = "data";
private static final String DIR_MEDIA = "media";
@@ -52,7 +52,9 @@ public class Environment {
private static final String DIR_FILES = "files";
private static final String DIR_CACHE = "cache";
/** {@hide} */
/**
* {@hide}
*/
@Deprecated
public static final String DIRECTORY_ANDROID = DIR_ANDROID;
@@ -60,7 +62,7 @@ public class Environment {
private static final File DIR_MEDIA_STORAGE = getDirectory(ENV_MEDIA_STORAGE, "/data/media");
private static final String CANONCIAL_EMULATED_STORAGE_TARGET = getCanonicalPathOrNull(
ENV_EMULATED_STORAGE_TARGET);
ENV_EMULATED_STORAGE_TARGET);
private static final String SYSTEM_PROPERTY_EFS_ENABLED = "persist.security.efs.enabled";
@@ -72,14 +74,16 @@ public class Environment {
private static volatile StorageVolume sPrimaryVolume;
private static StorageVolume getPrimaryVolume() {
return null;
return null;
}
static {
initForCurrentUser();
}
/** {@hide} */
/**
* {@hide}
*/
public static void initForCurrentUser() {
final int userId = UserHandle.myUserId();
sCurrentUser = new UserEnvironment(userId);
@@ -89,15 +93,23 @@ public class Environment {
}
}
/** {@hide} */
/**
* {@hide}
*/
public static class UserEnvironment {
// TODO: generalize further to create package-specific environment
/** External storage dirs, as visible to vold */
/**
* External storage dirs, as visible to vold
*/
private final File[] mExternalDirsForVold = null;
/** External storage dirs, as visible to apps */
/**
* External storage dirs, as visible to apps
*/
private final File[] mExternalDirsForApp = null;
/** Primary emulated storage dir for direct access */
/**
* Primary emulated storage dir for direct access
*/
private final File mEmulatedDirForDirect = null;
public UserEnvironment(int userId) {
@@ -106,7 +118,7 @@ public class Environment {
@Deprecated
public File getExternalStorageDirectory() {
return Environment.getExternalStorageDirectory();/*mExternalDirsForApp[0];*/
return Environment.getExternalStorageDirectory(); /*mExternalDirsForApp[0];*/
}
@Deprecated
@@ -236,14 +248,12 @@ public class Environment {
return false;
}
private static final File DATA_DIRECTORY
= getDirectory("ANDROID_DATA", "/data");
private static final File DATA_DIRECTORY = getDirectory("ANDROID_DATA", "/data");
/**
* @hide
*/
private static final File SECURE_DATA_DIRECTORY
= getDirectory("ANDROID_SECURE_DATA", "/data/secure");
private static final File SECURE_DATA_DIRECTORY = getDirectory("ANDROID_SECURE_DATA", "/data/secure");
private static final File DOWNLOAD_CACHE_DIRECTORY = getDirectory("DOWNLOAD_CACHE", "/cache");
@@ -312,7 +322,7 @@ public class Environment {
* @see #isExternalStorageRemovable()
*/
public static File getExternalStorageDirectory() {
if(app_data_dir_file == null) {
if (app_data_dir_file == null) {
app_data_dir_file = new File(native_get_app_data_dir());
}
@@ -321,23 +331,31 @@ public class Environment {
private static native String native_get_app_data_dir();
/** {@hide} */
/**
* {@hide}
*/
public static File getLegacyExternalStorageDirectory() {
return new File(System.getenv(ENV_EXTERNAL_STORAGE));
}
/** {@hide} */
/**
* {@hide}
*/
public static File getLegacyExternalStorageObbDirectory() {
return buildPath(getLegacyExternalStorageDirectory(), DIR_ANDROID, DIR_OBB);
}
/** {@hide} */
/**
* {@hide}
*/
public static File getEmulatedStorageSource(int userId) {
// /mnt/shell/emulated/0
return new File(System.getenv(ENV_EMULATED_STORAGE_SOURCE), String.valueOf(userId));
}
/** {@hide} */
/**
* {@hide}
*/
public static File getEmulatedStorageObbSource() {
// /mnt/shell/emulated/obb
return new File(System.getenv(ENV_EMULATED_STORAGE_SOURCE), DIR_OBB);
@@ -353,7 +371,7 @@ public class Environment {
* type.
*/
public static String DIRECTORY_MUSIC = "Music";
/**
* Standard directory in which to place any audio files that should be
* in the list of podcasts that the user can select (not as regular
@@ -365,7 +383,7 @@ public class Environment {
* type.
*/
public static String DIRECTORY_PODCASTS = "Podcasts";
/**
* Standard directory in which to place any audio files that should be
* in the list of ringtones that the user can select (not as regular
@@ -377,7 +395,7 @@ public class Environment {
* type.
*/
public static String DIRECTORY_RINGTONES = "Ringtones";
/**
* Standard directory in which to place any audio files that should be
* in the list of alarms that the user can select (not as regular
@@ -389,7 +407,7 @@ public class Environment {
* type.
*/
public static String DIRECTORY_ALARMS = "Alarms";
/**
* Standard directory in which to place any audio files that should be
* in the list of notifications that the user can select (not as regular
@@ -401,7 +419,7 @@ public class Environment {
* type.
*/
public static String DIRECTORY_NOTIFICATIONS = "Notifications";
/**
* Standard directory in which to place pictures that are available to
* the user. Note that this is primarily a convention for the top-level
@@ -409,7 +427,7 @@ public class Environment {
* in any directory.
*/
public static String DIRECTORY_PICTURES = "Pictures";
/**
* Standard directory in which to place movies that are available to
* the user. Note that this is primarily a convention for the top-level
@@ -417,7 +435,7 @@ public class Environment {
* in any directory.
*/
public static String DIRECTORY_MOVIES = "Movies";
/**
* Standard directory in which to place files that have been downloaded by
* the user. Note that this is primarily a convention for the top-level
@@ -427,7 +445,7 @@ public class Environment {
* backwards compatibility reasons.
*/
public static String DIRECTORY_DOWNLOADS = "Download";
/**
* The traditional location for pictures and videos when mounting the
* device as a camera. Note that this is primarily a convention for the
@@ -447,24 +465,24 @@ public class Environment {
* manage their own files, so you should be careful about what you put here
* to ensure you don't erase their files or get in the way of their own
* organization.
*
*
* <p>On devices with multiple users (as described by {@link UserManager}),
* each user has their own isolated external storage. Applications only
* have access to the external storage for the user they're running as.</p>
*
* <p>Here is an example of typical code to manipulate a picture on
* the public external storage:</p>
*
*
* {@sample development/samples/ApiDemos/src/com/example/android/apis/content/ExternalStorage.java
* public_picture}
*
*
* @param type The type of storage directory to return. Should be one of
* {@link #DIRECTORY_MUSIC}, {@link #DIRECTORY_PODCASTS},
* {@link #DIRECTORY_RINGTONES}, {@link #DIRECTORY_ALARMS},
* {@link #DIRECTORY_NOTIFICATIONS}, {@link #DIRECTORY_PICTURES},
* {@link #DIRECTORY_MOVIES}, {@link #DIRECTORY_DOWNLOADS}, or
* {@link #DIRECTORY_DCIM}. May not be null.
*
*
* @return Returns the File path for the directory. Note that this
* directory may not yet exist, so you must make sure it exists before
* using it such as with {@link File#mkdirs File.mkdirs()}.
@@ -491,7 +509,7 @@ public class Environment {
throwIfUserRequired();
return sCurrentUser.buildExternalStorageAppDataDirs(packageName);
}
/**
* Generates the raw path to an application's media
* @hide
@@ -500,7 +518,7 @@ public class Environment {
throwIfUserRequired();
return sCurrentUser.buildExternalStorageAppMediaDirs(packageName);
}
/**
* Generates the raw path to an application's OBB files
* @hide
@@ -509,7 +527,7 @@ public class Environment {
throwIfUserRequired();
return sCurrentUser.buildExternalStorageAppObbDirs(packageName);
}
/**
* Generates the path to an application's files.
* @hide
@@ -527,7 +545,7 @@ public class Environment {
throwIfUserRequired();
return sCurrentUser.buildExternalStorageAppCacheDirs(packageName);
}
/**
* Return the download/cache content directory.
*/
@@ -613,7 +631,7 @@ public class Environment {
/**
* Returns the current state of the primary "external" storage device.
*
*
* @see #getExternalStorageDirectory()
* @return one of {@link #MEDIA_UNKNOWN}, {@link #MEDIA_REMOVED},
* {@link #MEDIA_UNMOUNTED}, {@link #MEDIA_CHECKING},
@@ -695,7 +713,9 @@ public class Environment {
}
}
/** {@hide} */
/**
* {@hide}
*/
public static void setUserRequired(boolean userRequired) {
sUserRequired = userRequired;
}
@@ -703,7 +723,7 @@ public class Environment {
private static void throwIfUserRequired() {
if (sUserRequired) {
Log.wtf(TAG, "Path requests must specify a user by using UserEnvironment",
new Throwable());
new Throwable());
}
}
@@ -751,8 +771,7 @@ public class Environment {
*/
public static File maybeTranslateEmulatedPathToInternal(File path) {
// Fast return if not emulated, or missing variables
if (!Environment.isExternalStorageEmulated()
|| CANONCIAL_EMULATED_STORAGE_TARGET == null) {
if (!Environment.isExternalStorageEmulated() || CANONCIAL_EMULATED_STORAGE_TARGET == null) {
return path;
}
@@ -760,7 +779,7 @@ public class Environment {
final String rawPath = path.getCanonicalPath();
if (rawPath.startsWith(CANONCIAL_EMULATED_STORAGE_TARGET)) {
final File internalPath = new File(DIR_MEDIA_STORAGE,
rawPath.substring(CANONCIAL_EMULATED_STORAGE_TARGET.length()));
rawPath.substring(CANONCIAL_EMULATED_STORAGE_TARGET.length()));
if (internalPath.exists()) {
return internalPath;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,4 @@
package android.os;
public class IBinder {
}

View File

@@ -2,16 +2,16 @@
**
** Copyright 2007, 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
** 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
** 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
** 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.
*/
@@ -19,7 +19,9 @@ package android.os;
import android.os.Message;
/** @hide */
/**
* @hide
*/
interface IMessenger {
void send(Message msg);
void send(Message msg);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -23,64 +23,64 @@ package android.os;
* and handing that Messenger to another process.
*/
public final class Messenger {
private final IMessenger mTarget;
private final IMessenger mTarget;
/**
* Create a new Messenger pointing to the given Handler. Any Message
* objects sent through this Messenger will appear in the Handler as if
* {@link Handler#sendMessage(Message) Handler.sendMessage(Message)} had
* been called directly.
*
* @param target The Handler that will receive sent messages.
*/
public Messenger(Handler target) {
mTarget = target.getIMessenger();
}
/**
* Send a Message to this Messenger's Handler.
*
* @param message The Message to send. Usually retrieved through
* {@link Message#obtain() Message.obtain()}.
*
* @throws RemoteException Throws DeadObjectException if the target
* Handler no longer exists.
*/
public void send(Message message) throws RemoteException {
mTarget.send(message);
}
/**
* Retrieve the IBinder that this Messenger is using to communicate with
* its associated Handler.
*
* @return Returns the IBinder backing this Messenger.
*/
public IBinder getBinder() {
return null;//mTarget.asBinder();
}
/**
* Comparison operator on two Messenger objects, such that true
* is returned then they both point to the same Handler.
*/
public boolean equals(Object otherObj) {
/*if (otherObj == null) {
return false;
}
try {
return mTarget.asBinder().equals(((Messenger)otherObj)
.mTarget.asBinder());
} catch (ClassCastException e) {
}*/
return false;
}
/**
* Create a new Messenger pointing to the given Handler. Any Message
* objects sent through this Messenger will appear in the Handler as if
* {@link Handler#sendMessage(Message) Handler.sendMessage(Message)} had
* been called directly.
*
* @param target The Handler that will receive sent messages.
*/
public Messenger(Handler target) {
mTarget = target.getIMessenger();
}
public int hashCode() {
return 0;//mTarget.asBinder().hashCode();
}
public int describeContents() {
return 0;
}
/**
* Send a Message to this Messenger's Handler.
*
* @param message The Message to send. Usually retrieved through
* {@link Message#obtain() Message.obtain()}.
*
* @throws RemoteException Throws DeadObjectException if the target
* Handler no longer exists.
*/
public void send(Message message) throws RemoteException {
mTarget.send(message);
}
/**
* Retrieve the IBinder that this Messenger is using to communicate with
* its associated Handler.
*
* @return Returns the IBinder backing this Messenger.
*/
public IBinder getBinder() {
return null; // mTarget.asBinder();
}
/**
* Comparison operator on two Messenger objects, such that true
* is returned then they both point to the same Handler.
*/
public boolean equals(Object otherObj) {
/*if (otherObj == null) {
return false;
}
try {
return mTarget.asBinder().equals(((Messenger)otherObj)
.mTarget.asBinder());
} catch (ClassCastException e) {
}*/
return false;
}
public int hashCode() {
return 0; // mTarget.asBinder().hashCode();
}
public int describeContents() {
return 0;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -22,155 +22,157 @@ package android.os;
* used maliciously.
*/
public class PatternMatcher {
/**
* Pattern type: the given pattern must exactly match the string it is
* tested against.
*/
public static final int PATTERN_LITERAL = 0;
/**
* Pattern type: the given pattern must match the
* beginning of the string it is tested against.
*/
public static final int PATTERN_PREFIX = 1;
/**
* Pattern type: the given pattern is interpreted with a
* simple glob syntax for matching against the string it is tested against.
* In this syntax, you can use the '*' character to match against zero or
* more occurrences of the character immediately before. If the
* character before it is '.' it will match any character. The character
* '\' can be used as an escape. This essentially provides only the '*'
* wildcard part of a normal regexp.
*/
public static final int PATTERN_SIMPLE_GLOB = 2;
private final String mPattern;
private final int mType;
public PatternMatcher(String pattern, int type) {
mPattern = pattern;
mType = type;
}
/**
* Pattern type: the given pattern must exactly match the string it is
* tested against.
*/
public static final int PATTERN_LITERAL = 0;
public final String getPath() {
return mPattern;
}
public final int getType() {
return mType;
}
public boolean match(String str) {
return matchPattern(mPattern, str, mType);
}
/**
* Pattern type: the given pattern must match the
* beginning of the string it is tested against.
*/
public static final int PATTERN_PREFIX = 1;
public String toString() {
String type = "? ";
switch (mType) {
case PATTERN_LITERAL:
type = "LITERAL: ";
break;
case PATTERN_PREFIX:
type = "PREFIX: ";
break;
case PATTERN_SIMPLE_GLOB:
type = "GLOB: ";
break;
}
return "PatternMatcher{" + type + mPattern + "}";
}
public int describeContents() {
return 0;
}
static boolean matchPattern(String pattern, String match, int type) {
if (match == null) return false;
if (type == PATTERN_LITERAL) {
return pattern.equals(match);
} if (type == PATTERN_PREFIX) {
return match.startsWith(pattern);
} else if (type != PATTERN_SIMPLE_GLOB) {
return false;
}
final int NP = pattern.length();
if (NP <= 0) {
return match.length() <= 0;
}
final int NM = match.length();
int ip = 0, im = 0;
char nextChar = pattern.charAt(0);
while ((ip<NP) && (im<NM)) {
char c = nextChar;
ip++;
nextChar = ip < NP ? pattern.charAt(ip) : 0;
final boolean escaped = (c == '\\');
if (escaped) {
c = nextChar;
ip++;
nextChar = ip < NP ? pattern.charAt(ip) : 0;
}
if (nextChar == '*') {
if (!escaped && c == '.') {
if (ip >= (NP-1)) {
// at the end with a pattern match, so
// all is good without checking!
return true;
}
ip++;
nextChar = pattern.charAt(ip);
// Consume everything until the next character in the
// pattern is found.
if (nextChar == '\\') {
ip++;
nextChar = ip < NP ? pattern.charAt(ip) : 0;
}
do {
if (match.charAt(im) == nextChar) {
break;
}
im++;
} while (im < NM);
if (im == NM) {
// Whoops, the next character in the pattern didn't
// exist in the match.
return false;
}
ip++;
nextChar = ip < NP ? pattern.charAt(ip) : 0;
im++;
} else {
// Consume only characters matching the one before '*'.
do {
if (match.charAt(im) != c) {
break;
}
im++;
} while (im < NM);
ip++;
nextChar = ip < NP ? pattern.charAt(ip) : 0;
}
} else {
if (c != '.' && match.charAt(im) != c) return false;
im++;
}
}
if (ip >= NP && im >= NM) {
// Reached the end of both strings, all is good!
return true;
}
// One last check: we may have finished the match string, but still
// have a '.*' at the end of the pattern, which should still count
// as a match.
if (ip == NP-2 && pattern.charAt(ip) == '.'
&& pattern.charAt(ip+1) == '*') {
return true;
}
return false;
}
/**
* Pattern type: the given pattern is interpreted with a
* simple glob syntax for matching against the string it is tested against.
* In this syntax, you can use the '*' character to match against zero or
* more occurrences of the character immediately before. If the
* character before it is '.' it will match any character. The character
* '\' can be used as an escape. This essentially provides only the '*'
* wildcard part of a normal regexp.
*/
public static final int PATTERN_SIMPLE_GLOB = 2;
private final String mPattern;
private final int mType;
public PatternMatcher(String pattern, int type) {
mPattern = pattern;
mType = type;
}
public final String getPath() {
return mPattern;
}
public final int getType() {
return mType;
}
public boolean match(String str) {
return matchPattern(mPattern, str, mType);
}
public String toString() {
String type = "? ";
switch (mType) {
case PATTERN_LITERAL:
type = "LITERAL: ";
break;
case PATTERN_PREFIX:
type = "PREFIX: ";
break;
case PATTERN_SIMPLE_GLOB:
type = "GLOB: ";
break;
}
return "PatternMatcher{" + type + mPattern + "}";
}
public int describeContents() {
return 0;
}
static boolean matchPattern(String pattern, String match, int type) {
if (match == null)
return false;
if (type == PATTERN_LITERAL) {
return pattern.equals(match);
}
if (type == PATTERN_PREFIX) {
return match.startsWith(pattern);
} else if (type != PATTERN_SIMPLE_GLOB) {
return false;
}
final int NP = pattern.length();
if (NP <= 0) {
return match.length() <= 0;
}
final int NM = match.length();
int ip = 0, im = 0;
char nextChar = pattern.charAt(0);
while ((ip < NP) && (im < NM)) {
char c = nextChar;
ip++;
nextChar = ip < NP ? pattern.charAt(ip) : 0;
final boolean escaped = (c == '\\');
if (escaped) {
c = nextChar;
ip++;
nextChar = ip < NP ? pattern.charAt(ip) : 0;
}
if (nextChar == '*') {
if (!escaped && c == '.') {
if (ip >= (NP - 1)) {
// at the end with a pattern match, so
// all is good without checking!
return true;
}
ip++;
nextChar = pattern.charAt(ip);
// Consume everything until the next character in the
// pattern is found.
if (nextChar == '\\') {
ip++;
nextChar = ip < NP ? pattern.charAt(ip) : 0;
}
do {
if (match.charAt(im) == nextChar) {
break;
}
im++;
} while (im < NM);
if (im == NM) {
// Whoops, the next character in the pattern didn't
// exist in the match.
return false;
}
ip++;
nextChar = ip < NP ? pattern.charAt(ip) : 0;
im++;
} else {
// Consume only characters matching the one before '*'.
do {
if (match.charAt(im) != c) {
break;
}
im++;
} while (im < NM);
ip++;
nextChar = ip < NP ? pattern.charAt(ip) : 0;
}
} else {
if (c != '.' && match.charAt(im) != c)
return false;
im++;
}
}
if (ip >= NP && im >= NM) {
// Reached the end of both strings, all is good!
return true;
}
// One last check: we may have finished the match string, but still
// have a '.*' at the end of the pattern, which should still count
// as a match.
if (ip == NP - 2 && pattern.charAt(ip) == '.' && pattern.charAt(ip + 1) == '*') {
return true;
}
return false;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -21,11 +21,11 @@ import android.util.AndroidException;
* Parent exception for all Binder remote-invocation errors
*/
public class RemoteException extends AndroidException {
public RemoteException() {
super();
}
public RemoteException() {
super();
}
public RemoteException(String message) {
super(message);
}
public RemoteException(String message) {
super(message);
}
}

View File

@@ -16,7 +16,6 @@
package android.os;
/**
* Core timekeeping facilities.
*
@@ -89,24 +88,23 @@ package android.os;
* </ul>
*/
public final class SystemClock {
/**
* This class is uninstantiable.
*/
private SystemClock() {
// This space intentionally left blank.
}
/**
* This class is uninstantiable.
*/
private SystemClock() {
// This space intentionally left blank.
}
/**
* Waits a given number of milliseconds (of uptimeMillis) before returning.
* Similar to {@link java.lang.Thread#sleep(long)}, but does not throw
* {@link InterruptedException}; {@link Thread#interrupt()} events are
* deferred until the next interruptible operation. Does not return until
* at least the specified number of milliseconds has elapsed.
*
* @param ms to sleep before returning, in milliseconds of uptime.
*/
public static void sleep(long ms)
{
/**
* Waits a given number of milliseconds (of uptimeMillis) before returning.
* Similar to {@link java.lang.Thread#sleep(long)}, but does not throw
* {@link InterruptedException}; {@link Thread#interrupt()} events are
* deferred until the next interruptible operation. Does not return until
* at least the specified number of milliseconds has elapsed.
*
* @param ms to sleep before returning, in milliseconds of uptime.
*/
public static void sleep(long ms) {
System.out.println("!!! sleep(...) doesn't work, need to implement uptimeMillis");
/*
long start = uptimeMillis();
@@ -129,60 +127,60 @@ public final class SystemClock {
Thread.currentThread().interrupt();
}
*/}
/**
* Sets the current wall time, in milliseconds. Requires the calling
* process to have appropriate permissions.
*
* @return if the clock was successfully set to the specified time.
*/
native public static boolean setCurrentTimeMillis(long millis);
/**
* Returns milliseconds since boot, not counting time spent in deep sleep.
*
* @return milliseconds of non-sleep uptime since boot.
*/
/*native */public static long uptimeMillis() {
/**
* Sets the current wall time, in milliseconds. Requires the calling
* process to have appropriate permissions.
*
* @return if the clock was successfully set to the specified time.
*/
native public static boolean setCurrentTimeMillis(long millis);
/**
* Returns milliseconds since boot, not counting time spent in deep sleep.
*
* @return milliseconds of non-sleep uptime since boot.
*/
/*native */ public static long uptimeMillis() {
return 654000; // FIXME
}
/**
* Returns milliseconds since boot, including time spent in sleep.
*
* @return elapsed milliseconds since boot.
*/
native public static long elapsedRealtime();
/**
* Returns milliseconds since boot, including time spent in sleep.
*
* @return elapsed milliseconds since boot.
*/
native public static long elapsedRealtime();
/**
* Returns nanoseconds since boot, including time spent in sleep.
*
* @return elapsed nanoseconds since boot.
*/
public static native long elapsedRealtimeNanos();
/**
* Returns nanoseconds since boot, including time spent in sleep.
*
* @return elapsed nanoseconds since boot.
*/
public static native long elapsedRealtimeNanos();
/**
* Returns milliseconds running in the current thread.
*
* @return elapsed milliseconds in the thread
*/
public static native long currentThreadTimeMillis();
/**
* Returns milliseconds running in the current thread.
*
* @return elapsed milliseconds in the thread
*/
public static native long currentThreadTimeMillis();
/**
* Returns microseconds running in the current thread.
*
* @return elapsed microseconds in the thread
*
* @hide
*/
public static native long currentThreadTimeMicro();
/**
* Returns microseconds running in the current thread.
*
* @return elapsed microseconds in the thread
*
* @hide
*/
public static native long currentThreadTimeMicro();
/**
* Returns current wall time in microseconds.
*
* @return elapsed microseconds in wall time
*
* @hide
*/
public static native long currentTimeMicro();
/**
* Returns current wall time in microseconds.
*
* @return elapsed microseconds in wall time
*
* @hide
*/
public static native long currentTimeMicro();
}

Some files were not shown because too many files have changed in this diff Show More