add bunch of new java APIs: mostly stubs or copied from AOSP

Many of these classes are only needed to be subclassed by androidx
support library, which is used in many android apps
This commit is contained in:
Julian Winkler
2023-08-17 10:46:24 +02:00
parent a8e39cd613
commit 82744e9e5e
87 changed files with 2746 additions and 46 deletions

View File

@@ -0,0 +1,5 @@
package android.accounts;
public class AccountManager {
}

View File

@@ -0,0 +1,9 @@
package android.animation;
public class Animator {
public void setTarget(Object target) {}
public void start() {}
}

View File

@@ -0,0 +1,11 @@
package android.animation;
import android.content.Context;
public class AnimatorInflater {
public static Animator loadAnimator(Context context, int resId) {
return new Animator();
}
}

View File

@@ -0,0 +1,56 @@
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.animation;
/**
* This adapter class provides empty implementations of the methods from {@link android.animation.Animator.AnimatorListener}.
* Any custom listener that cares only about a subset of the methods of this listener can
* simply subclass this adapter class instead of implementing the interface directly.
*/
public abstract class AnimatorListenerAdapter /*implements Animator.AnimatorListener,
Animator.AnimatorPauseListener*/ {
/**
* {@inheritDoc}
*/
public void onAnimationCancel(Animator animation) {
}
/**
* {@inheritDoc}
*/
public void onAnimationEnd(Animator animation) {
}
/**
* {@inheritDoc}
*/
public void onAnimationRepeat(Animator animation) {
}
/**
* {@inheritDoc}
*/
public void onAnimationStart(Animator animation) {
}
/**
* {@inheritDoc}
*/
public void onAnimationPause(Animator animation) {
}
/**
* {@inheritDoc}
*/
public void onAnimationResume(Animator animation) {
}
}

View File

@@ -0,0 +1,5 @@
package android.animation;
public class LayoutTransition {
}

View File

@@ -0,0 +1,33 @@
package android.animation;
public class ValueAnimator {
public static ValueAnimator ofFloat(float... values) {
return new ValueAnimator();
}
public ValueAnimator setDuration(long duration) {
return this;
}
public void addUpdateListener(AnimatorUpdateListener listener) {}
public static long getFrameDelay() {
return 20; // 20ms frame interval
}
/**
* Implementors of this interface can add themselves as update listeners
* to an <code>ValueAnimator</code> instance to receive callbacks on every animation
* frame, after the current frame's values have been calculated for that
* <code>ValueAnimator</code>.
*/
public static interface AnimatorUpdateListener {
/**
* <p>Notifies the occurrence of another frame of the animation.</p>
*
* @param animation The animation which was repeated.
*/
void onAnimationUpdate(ValueAnimator animation);
}
}

View File

@@ -1,5 +1,6 @@
package android.app;
import android.R;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -102,6 +103,7 @@ public class Activity extends Context {
protected void onCreate(Bundle savedInstanceState) {
System.out.println("- onCreate - yay!");
new ViewGroup(this).setId(R.id.content);
return;
}
@@ -263,6 +265,22 @@ public class Activity extends Context {
nativeFinish(getWindow().native_window);
}
public Object getLastNonConfigurationInstance() {
return null;
}
public FragmentManager getFragmentManager() {
return new FragmentManager();
}
public LayoutInflater getLayoutInflater() {
return layout_inflater;
}
public CharSequence getTitle() {
return "Title";
}
private native void nativeFinish(long native_window);
private static native void nativeStartActivity(Activity activity);
}

View File

@@ -0,0 +1,5 @@
package android.app;
public class DownloadManager {
}

View File

@@ -0,0 +1,5 @@
package android.app;
public class Fragment {
}

View File

@@ -0,0 +1,16 @@
package android.app;
public class FragmentManager {
public Fragment findFragmentByTag(String tag) {
return null;
}
public FragmentTransaction beginTransaction() {
return new FragmentTransaction();
}
public boolean executePendingTransactions() {
return false;
}
}

View File

@@ -0,0 +1,12 @@
package android.app;
public class FragmentTransaction {
public FragmentTransaction add(Fragment fragment, String string) {
return this;
}
public int commit() {
return 0;
}
}

View File

@@ -0,0 +1,5 @@
package android.app;
public class SearchManager {
}

View File

@@ -0,0 +1,10 @@
package android.app;
import android.content.res.Configuration;
public class UiModeManager {
public int getCurrentModeType() {
return Configuration.UI_MODE_TYPE_NORMAL;
}
}

View File

@@ -0,0 +1,5 @@
package android.app;
public class WallpaperManager {
}

View File

@@ -0,0 +1,5 @@
package android.app.admin;
public class DevicePolicyManager {
}

View File

@@ -6,6 +6,7 @@ import android.app.Application;
import android.app.KeyguardManager;
import android.app.NotificationManager;
import android.app.SharedPreferencesImpl;
import android.app.UiModeManager;
import android.content.BroadcastReceiver;
import android.content.ClipboardManager;
import android.content.Intent;
@@ -165,6 +166,8 @@ public class Context extends Object {
return new InputManager();
case "location":
return new LocationManager();
case "uimode":
return new UiModeManager();
default:
System.out.println("!!!!!!! getSystemService: case >" + name + "< is not implemented yet");
return null;
@@ -348,4 +351,8 @@ public class Context extends Object {
public void setTheme(int resId) {
theme.applyStyle(resId, true);
}
public final CharSequence getText(int resId) {
return getResources().getText(resId);
}
}

View File

@@ -0,0 +1,14 @@
package android.content;
public class ContextWrapper extends Context {
private Context baseContext;
public ContextWrapper(Context baseContext) {
this.baseContext = baseContext;
}
public Context getBaseContext() {
return baseContext;
}
}

View File

@@ -185,6 +185,14 @@ public class Intent {
return component;
}
public boolean hasExtra(String name) {
return extras.containsKey(name);
}
public Serializable getSerializableExtra(String name) {
return (Serializable)extras.get(name);
}
@Override
public String toString() {
return "Intent [component=" + component + ", extras=" + extras + "]";

View File

@@ -1337,6 +1337,34 @@ public class PackageManager {
*/
public static final String EXTRA_REQUEST_PERMISSION_PERMISSION_LIST = "android.content.pm.extra.PERMISSION_LIST";
// dummy certificate
public final static byte[] X509_DUMMY = (
"-----BEGIN CERTIFICATE-----\n" +
"MIIERjCCAy6gAwIBAgIJAIz+EYMBU6aQMA0GCSqGSIb3DQEBBQUAMIGiMQswCQYD\n" +
"VQQGEwJDQTELMAkGA1UECBMCQkMxEjAQBgNVBAcTCVZhbmNvdXZlcjEWMBQGA1UE\n" +
"ChMNd3d3LmN1Y2JjLmNvbTEUMBIGA1UECxQLY29tbW9uc19zc2wxHTAbBgNVBAMU\n" +
"FGRlbW9faW50ZXJtZWRpYXRlX2NhMSUwIwYJKoZ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W0RcjNBpO\n" +
"c2JlGO9auXv2GDP4IYiXElLJ6VSqc8WvDikv0JmCCWm0Zga+bZbR/EWN5DeEtFdF\n" +
"815CLpJZNcYwiYwGy/CVQ7w2TnXlG+mraZOz+owr+cL6J/ZesbdEWfjoS1+cUEhE\n" +
"HwlNrAu8jlZ2UqSgskSWlhYdMTAP9CPHiUv9N7FcT58Itv/I4fKREINQYjDpvQcx\n" +
"SaTYb9dr5sB4WLNglk7zxDtM80H518VvihTcP7FHL+Gn6g4j5fkI98+S\n" +
"-----END CERTIFICATE-----\n").getBytes();
/**
* Retrieve overall information about an application package that is
* installed on the system.
@@ -1374,7 +1402,7 @@ public class PackageManager {
public PackageInfo getPackageInfo(String packageName, int flags) throws NameNotFoundException {
PackageInfo packageInfo = new PackageInfo();
if ((flags & GET_SIGNATURES) == GET_SIGNATURES) {
packageInfo.signatures = new Signature[0];
packageInfo.signatures = new Signature[]{new Signature(X509_DUMMY)};
}
return packageInfo;
}

View File

@@ -23,7 +23,6 @@ import android.os.Bundle;
import java.io.Closeable;
class CharArrayBuffer {}
class DataSetObserver {}
/**
* This interface provides random read-write access to the result set returned

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