api-impl: misc stubs and fixes

This commit is contained in:
Mis012 2025-03-26 21:01:57 +01:00
parent fd2e9f43b6
commit f3332b7201
25 changed files with 234 additions and 37 deletions

View file

@ -8,4 +8,8 @@ public class KeyguardManager {
public boolean isKeyguardLocked() {
return false;
}
public boolean isKeyguardSecure() {
return true;
}
}

View file

@ -0,0 +1,9 @@
package android.app.backup;
import android.content.ContextWrapper;
public abstract class BackupAgent extends ContextWrapper {
public BackupAgent() {
super(null);
}
}

View file

@ -0,0 +1,5 @@
package android.app.backup;
public class BackupAgentHelper extends BackupAgent {
}

View file

@ -0,0 +1,8 @@
package android.app.backup;
import android.content.Context;
public class BackupManager {
public BackupManager(Context context) {
}
}

View file

@ -10,15 +10,7 @@ public class JobInfo {
public static final class Builder {
public Builder(int jobId, ComponentName jobService) {}
public Builder setMinimumLatency(long minLatencyMillis) {
return this;
}
public Builder setRequiredNetworkType(int networkType) {
return this;
}
public Builder setOverrideDeadline(long a) {
public Builder setBackoffCriteria(long initialBackoffMillis, int backoffPolicy) {
return this;
}
@ -26,15 +18,15 @@ public class JobInfo {
return this;
}
public Builder setRequiresCharging(boolean requiresCharging) {
public Builder setMinimumLatency(long minLatencyMillis) {
return this;
}
public Builder setRequiresDeviceIdle(boolean requiresDeviceIdle) {
public Builder setOverrideDeadline(long a) {
return this;
}
public Builder setBackoffCriteria(long initialBackoffMillis, int backoffPolicy) {
public Builder setPeriodic(long dummy) {
return this;
}
@ -42,6 +34,18 @@ public class JobInfo {
return this;
}
public Builder setRequiredNetworkType(int networkType) {
return this;
}
public Builder setRequiresCharging(boolean requires_charging) {
return this;
}
public Builder setRequiresDeviceIdle(boolean requires_device_idle) {
return this;
}
public JobInfo build() {
return new JobInfo();
}

View file

@ -21,4 +21,7 @@ public class JobScheduler {
public int schedule(JobInfo job) {
return 1; //RESULT_SUCCESS
}
public void cancel(int dummy) {
}
}

View file

@ -238,6 +238,8 @@ public class Context extends Object {
return new JobScheduler();
case "appops":
return new AppOpsManager();
case "user":
return new UserManager();
default:
Slog.e(TAG, "!!!!!!! getSystemService: case >" + name + "< is not implemented yet");
return null;
@ -717,4 +719,9 @@ public class Context extends Object {
return new String[0];
}
}
public Context createDeviceProtectedStorageContext() {
/* FIXME: should be a different context, and return different storage locations */
return this;
}
}

View file

@ -56,6 +56,10 @@ public class IntentFilter {
public void addDataPath(String path, int type) {}
public final void addDataSchemeSpecificPart(String ssp, int type) {
/* FIXME */
}
public boolean hasDataScheme(String dataScheme) {
return dataSchemes.contains(dataScheme);
}

View file

@ -16,4 +16,8 @@ public class PathMeasure {
public boolean getSegment(float start, float end, Path dst, boolean forceClosed) {
return false;
}
public boolean getPosTan(float distance, float[] pos, float[] tan) {
return false;
}
}

View file

@ -66,22 +66,24 @@ public class DrawableContainer extends Drawable {
@Override
public void draw(Canvas canvas) {
state.drawables[curIndex].draw(canvas);
if (curIndex != -1)
state.drawables[curIndex].draw(canvas);
}
@Override
public int getIntrinsicHeight() {
return state.drawables[curIndex].getIntrinsicHeight();
return curIndex != -1 ? state.drawables[curIndex].getIntrinsicHeight() : -1;
}
@Override
public int getIntrinsicWidth() {
return state.drawables[curIndex].getIntrinsicWidth();
return curIndex != -1 ? state.drawables[curIndex].getIntrinsicWidth() : -1;
}
@Override
public void setBounds(int left, int top, int right, int bottom) {
state.drawables[curIndex].setBounds(left, top, right, bottom);
if (curIndex != -1)
state.drawables[curIndex].setBounds(left, top, right, bottom);
}
public void setEnterFadeDuration(int duration) {}

View file

@ -2,8 +2,6 @@ package android.net;
import android.os.Handler;
class NetworkCapabilities {}
public class ConnectivityManager {
public class NetworkCallback {
@ -35,10 +33,14 @@ public class ConnectivityManager {
return new Network();
}
public void registerDefaultNetworkCallback(NetworkCallback cb, Handler hdl) {}
public Network[] getAllNetworks() {
return new Network[] { getActiveNetwork() };
}
public NetworkCapabilities getNetworkCapabilities(Network network) {
return null;
}
public void registerDefaultNetworkCallback(NetworkCallback cb, Handler hdl) {}
}

View file

@ -0,0 +1,7 @@
package android.net;
public final class NetworkCapabilities {
public boolean hasCapability(int capability) {
return false;
}
}

View file

@ -12,7 +12,12 @@ public class BaseBundle {
// Invariant - exactly one of mMap / mParcelledData will be null
// (except inside a call to unparcel)
/* package */ ArrayMap<String, Object> mMap = new ArrayMap<>();
/* package */ ArrayMap<String, Object> mMap;
public BaseBundle() {
mMap = new ArrayMap<String, Object>();
}
// Log a message if the value was non-null but not of the expected type
void typeWarning(String key, Object value, String className,

View file

@ -57,7 +57,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable {
* Constructs a new, empty Bundle.
*/
public Bundle() {
mMap = new ArrayMap<String, Object>();
super();
mClassLoader = getClass().getClassLoader();
}

View file

@ -2,12 +2,27 @@ package android.os;
public class SystemProperties {
public static String get(String prop) {
android.util.Log.i("SystemProperties", "Grabbing prop " + prop);
return null;
android.util.Log.i("SystemProperties", "Grabbing String prop " + prop);
return "";
}
public static String get(String prop, String def) {
android.util.Log.i("SystemProperties", "Grabbing String prop " + prop + ", default " + def);
return def;
}
public boolean getBoolean(String prop, boolean def) {
android.util.Log.i("SystemProperties", "Grabbing prop " + prop + ", default " + def);
android.util.Log.i("SystemProperties", "Grabbing boolean prop " + prop + ", default " + def);
return def;
}
public static int getInt(String prop, int def) {
android.util.Log.i("SystemProperties", "Grabbing int prop " + prop + ", default " + def);
return def;
}
public static long getLong(String prop, long def) {
android.util.Log.i("SystemProperties", "Grabbing long prop " + prop + ", default " + def);
return def;
}
}

View file

@ -1,3 +1,6 @@
package android.provider;
public interface BaseColumns {}
public interface BaseColumns {
public static final String _ID = "_id";
public static final String _COUNT = "_count";
}

View file

@ -6,9 +6,13 @@ public class ContactsContract {
public static final class CommonDataKinds {
public static class Phone {
public static final class Phone {
public static final Uri CONTENT_URI = Uri.parse("content://com.android.contacts/phones");
}
public static final class Email {
public static final Uri CONTENT_URI = Uri.parse("content://com.android.contacts/emails");
}
}
public static final class Profile {

View file

@ -6,6 +6,12 @@ import android.util.AndroidException;
public class Settings {
public static final class Secure {
public static final Uri CONTENT_URI = Uri.parse("content://settings/secure");
public static Uri getUriFor(String name) {
return Uri.withAppendedPath(CONTENT_URI, name);
}
public static String getString(ContentResolver content_resolver, String key) {
switch (key) {
case "android_id":
@ -25,6 +31,8 @@ public class Settings {
switch (key) {
case "limit_ad_tracking":
return 1; // obviously, duh
case "user_setup_complete":
return 1;
default:
java.lang.System.out.println("!!!! Settings$Secure.getInt: unknown key: >" + key + "<");
return def;

View file

@ -0,0 +1,10 @@
package android.text;
import android.view.View;
public class AutoText {
public static String get(CharSequence src, final int start, final int end, View view) {
return null;
}
}

View file

@ -18,11 +18,11 @@
package android.text;
import com.android.internal.util.ArrayUtils;
import java.util.Iterator;
import java.util.Locale;
import java.util.regex.Pattern;
import com.android.internal.util.ArrayUtils;
public class TextUtils {
public static int getLayoutDirectionFromLocale(Locale locale) {
return 0 /*LTR*/; // FIXME
@ -255,7 +255,7 @@ public class TextUtils {
}
if (buf == null || buf.length < len)
buf = ArrayUtils.newUnpaddedCharArray(len);
buf = ArrayUtils.newUnpaddedCharArray(len);
return buf;
}
@ -377,4 +377,80 @@ public class TextUtils {
}
return true;
}
/**
* An interface for splitting strings according to rules that are opaque to the user of this
* interface. This also has less overhead than split, which uses regular expressions and
* allocates an array to hold the results.
*
* <p>The most efficient way to use this class is:
*
* <pre>
* // Once
* TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(delimiter);
*
* // Once per string to split
* splitter.setString(string);
* for (String s : splitter) {
* ...
* }
* </pre>
*/
public interface StringSplitter extends Iterable<String> {
public void setString(String string);
}
/**
* A simple string splitter.
*
* <p>If the final character in the string to split is the delimiter then no empty string will
* be returned for the empty string after that delimeter. That is, splitting <tt>"a,b,"</tt> on
* comma will return <tt>"a", "b"</tt>, not <tt>"a", "b", ""</tt>.
*/
public static class SimpleStringSplitter implements StringSplitter, Iterator<String> {
private String mString;
private char mDelimiter;
private int mPosition;
private int mLength;
/**
* Initializes the splitter. setString may be called later.
* @param delimiter the delimeter on which to split
*/
public SimpleStringSplitter(char delimiter) {
mDelimiter = delimiter;
}
/**
* Sets the string to split
* @param string the string to split
*/
public void setString(String string) {
mString = string;
mPosition = 0;
mLength = mString.length();
}
public Iterator<String> iterator() {
return this;
}
public boolean hasNext() {
return mPosition < mLength;
}
public String next() {
int end = mString.indexOf(mDelimiter, mPosition);
if (end == -1) {
end = mLength;
}
String nextString = mString.substring(mPosition, end);
mPosition = end + 1; // Skip the delimiter.
return nextString;
}
public void remove() {
throw new UnsupportedOperationException();
}
}
}

View file

@ -1,5 +1,5 @@
package android.text.style;
public class BackgroundColorSpan {
public class BackgroundColorSpan extends CharacterStyle {
public BackgroundColorSpan(int color) {}
}

View file

@ -1,4 +1,4 @@
package android.text.style;
public class UnderlineSpan {
public class UnderlineSpan extends CharacterStyle {
}

View file

@ -398,6 +398,23 @@ public class TypedValue {
return res;
}
public int getComplexUnit() {
return (data >> COMPLEX_UNIT_SHIFT) & COMPLEX_UNIT_MASK;
}
/**
* Return the complex unit type for the given complex dimension. For example, a dimen type
* with value 12sp will return {@link #COMPLEX_UNIT_SP}. Use with values created with {@link
* #createComplexDimension(int, int)} etc.
*
* @return The complex unit type.
*
* @hide
*/
public static int getUnitFromComplexDimension(int complexDimension) {
return COMPLEX_UNIT_MASK & (complexDimension >> TypedValue.COMPLEX_UNIT_SHIFT);
}
/**
* Converts an unpacked complex data value holding a dimension to its final floating
* point value. The two parameters <var>unit</var> and <var>value</var>
@ -572,8 +589,4 @@ public class TypedValue {
sb.append("}");
return sb.toString();
}
public int getComplexUnit() {
return (data >> COMPLEX_UNIT_SHIFT) & COMPLEX_UNIT_MASK;
}
};

View file

@ -60,7 +60,7 @@ public class LayoutInflater {
return mFactory;
}
public final void setFactory(LayoutInflater.Factory factory){
public void setFactory(LayoutInflater.Factory factory){
mFactory = factory;
}

View file

@ -60,6 +60,8 @@ srcs = [
'android/app/UiModeManager.java',
'android/app/WallpaperManager.java',
'android/app/admin/DevicePolicyManager.java',
'android/app/backup/BackupAgentHelper.java',
'android/app/backup/BackupManager.java',
'android/app/job/JobInfo.java',
'android/app/job/JobScheduler.java',
'android/app/job/JobService.java',
@ -283,6 +285,7 @@ srcs = [
'android/media/tv/TvInputManager.java',
'android/net/ConnectivityManager.java',
'android/net/Network.java',
'android/net/NetworkCapabilities.java',
'android/net/NetworkInfo.java',
'android/net/NetworkRequest.java',
'android/net/SSLCertificateSocketFactory.java',
@ -368,6 +371,7 @@ srcs = [
'android/telephony/PhoneStateListener.java',
'android/telephony/SubscriptionManager.java',
'android/telephony/TelephonyManager.java',
'android/text/AutoText.java',
'android/text/BoringLayout.java',
'android/text/ClipboardManager.java',
'android/text/Editable.java',