Merge pull request #6923 from atorralba/atorralba/android-fragment-injection

Java: CWE-470  - Queries to detect Fragment Injection in Android applications
This commit is contained in:
Tony Torralba
2022-01-17 14:02:15 +01:00
committed by GitHub
35 changed files with 4537 additions and 663 deletions

View File

@@ -0,0 +1,16 @@
/** Provides classes and predicates to track Android fragments. */
import java
/** The class `android.app.Fragment` */
class Fragment extends Class {
Fragment() { this.hasQualifiedName("android.app", "Fragment") }
}
/** The method `instantiate` of the class `android.app.Fragment`. */
class FragmentInstantiateMethod extends Method {
FragmentInstantiateMethod() {
this.getDeclaringType() instanceof Fragment and
this.hasName("instantiate")
}
}

View File

@@ -0,0 +1,83 @@
/** Provides classes and predicates to reason about Android Fragment injection vulnerabilities. */
import java
private import semmle.code.java.dataflow.TaintTracking
private import semmle.code.java.dataflow.ExternalFlow
private import semmle.code.java.frameworks.android.Android
private import semmle.code.java.frameworks.android.Fragment
private import semmle.code.java.Reflection
/** The method `isValidFragment` of the class `android.preference.PreferenceActivity`. */
class IsValidFragmentMethod extends Method {
IsValidFragmentMethod() {
this.getDeclaringType()
.getASupertype*()
.hasQualifiedName("android.preference", "PreferenceActivity") and
this.hasName("isValidFragment")
}
/**
* Holds if this method makes the Activity it is declared in vulnerable to Fragment injection,
* that is, all code paths in this method return `true` and the Activity is exported.
*/
predicate isUnsafe() {
this.getDeclaringType().(AndroidActivity).isExported() and
forex(ReturnStmt retStmt | retStmt.getEnclosingCallable() = this |
retStmt.getResult().(BooleanLiteral).getBooleanValue() = true
)
}
}
/**
* A sink for Fragment injection vulnerabilities,
* that is, method calls that dynamically add fragments to activities.
*/
abstract class FragmentInjectionSink extends DataFlow::Node { }
/** An additional taint step for flows related to Fragment injection vulnerabilites. */
class FragmentInjectionAdditionalTaintStep extends Unit {
/**
* Holds if the step from `node1` to `node2` should be considered a taint
* step in flows related to Fragment injection vulnerabilites.
*/
abstract predicate step(DataFlow::Node n1, DataFlow::Node n2);
}
private class FragmentInjectionSinkModels extends SinkModelCsv {
override predicate row(string row) {
row =
["android.app", "android.support.v4.app", "androidx.fragment.app"] +
";FragmentTransaction;true;" +
[
"add;(Class,Bundle,String);;Argument[0]", "add;(Fragment,String);;Argument[0]",
"add;(int,Class,Bundle);;Argument[1]", "add;(int,Fragment);;Argument[1]",
"add;(int,Class,Bundle,String);;Argument[1]", "add;(int,Fragment,String);;Argument[1]",
"attach;(Fragment);;Argument[0]", "replace;(int,Class,Bundle);;Argument[1]",
"replace;(int,Fragment);;Argument[1]", "replace;(int,Class,Bundle,String);;Argument[1]",
"replace;(int,Fragment,String);;Argument[1]",
] + ";fragment-injection"
}
}
private class DefaultFragmentInjectionSink extends FragmentInjectionSink {
DefaultFragmentInjectionSink() { sinkNode(this, "fragment-injection") }
}
private class DefaultFragmentInjectionAdditionalTaintStep extends FragmentInjectionAdditionalTaintStep {
override predicate step(DataFlow::Node n1, DataFlow::Node n2) {
exists(ReflectiveClassIdentifierMethodAccess ma |
ma.getArgument(0) = n1.asExpr() and ma = n2.asExpr()
)
or
exists(NewInstance ni |
ni.getQualifier() = n1.asExpr() and
ni = n2.asExpr()
)
or
exists(MethodAccess ma |
ma.getMethod() instanceof FragmentInstantiateMethod and
ma.getArgument(1) = n1.asExpr() and
ma = n2.asExpr()
)
}
}

View File

@@ -0,0 +1,22 @@
/** Provides classes and predicates to be used in queries related to Android Fragment injection. */
import java
import semmle.code.java.dataflow.FlowSources
import semmle.code.java.dataflow.TaintTracking
import semmle.code.java.security.FragmentInjection
/**
* A taint-tracking configuration for unsafe user input
* that is used to create Android fragments dynamically.
*/
class FragmentInjectionTaintConf extends TaintTracking::Configuration {
FragmentInjectionTaintConf() { this = "FragmentInjectionTaintConf" }
override predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
override predicate isSink(DataFlow::Node sink) { sink instanceof FragmentInjectionSink }
override predicate isAdditionalTaintStep(DataFlow::Node n1, DataFlow::Node n2) {
any(FragmentInjectionAdditionalTaintStep c).step(n1, n2)
}
}

View File

@@ -0,0 +1,60 @@
<!DOCTYPE qhelp PUBLIC "-//Semmle//qhelp//EN" "qhelp.dtd">
<qhelp>
<overview>
<p>
When fragments are instantiated with externally provided names, this exposes any exported activity that dynamically
creates and hosts the fragment to fragment injection. A malicious application could provide the
name of an arbitrary fragment, even one not designed to be externally accessible, and inject it into the activity.
This can bypass access controls and expose the application to unintended effects.
</p>
<p>
Fragments are reusable parts of an Android application's user interface.
Even though a fragment controls its own lifecycle and layout, and handles its input events,
it cannot exist on its own: it must be hosted either by an activity or another fragment.
This means that, normally, a fragment will be accessible by third-party applications (that is, exported)
only if its hosting activity is itself exported.
</p>
</overview>
<recommendation>
<p>
In general, do not instantiate classes (including fragments) with user-provided names
unless the name has been properly validated.
Also, if an exported activity is extending the <code>PreferenceActivity</code> class, make sure that
the <code>isValidFragment</code> method is overriden and only returns <code>true</code> when the provided
<code>fragmentName</code> points to an intended fragment.
</p>
</recommendation>
<example>
<p>
The following example shows two cases: in the first one, untrusted data is used to instantiate and
add a fragment to an activity, while in the second one, a fragment is safely added with a static name.
</p>
<sample src="FragmentInjection.java" />
<p>
The next example shows two activities that extend <code>PreferenceActivity</code>. The first activity overrides
<code>isValidFragment</code>, but it wrongly returns <code>true</code> unconditionally. The second activity
correctly overrides <code>isValidFragment</code> so that it only returns <code>true</code> when <code>fragmentName</code>
is a trusted fragment name.
</p>
<sample src="FragmentInjectionInPreferenceActivity.java" />
</example>
<references>
<li> Google Help:
<a href="https://support.google.com/faqs/answer/7188427?hl=en">How to fix Fragment Injection vulnerability</a>.
</li>
<li>
IBM Security Systems:
<a href="https://securityintelligence.com/wp-content/uploads/2013/12/android-collapses-into-fragments.pdf">Android collapses into Fragments</a>.
</li>
<li>
Android Developers:
<a href="https://developer.android.com/guide/fragments">Fragments</a>
</li>
</references>
</qhelp>

View File

@@ -0,0 +1,22 @@
public class MyActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstance) {
try {
super.onCreate(savedInstance);
// BAD: Fragment instantiated from user input without validation
{
String fName = getIntent().getStringExtra("fragmentName");
getFragmentManager().beginTransaction().replace(com.android.internal.R.id.prefs,
Fragment.instantiate(this, fName, null)).commit();
}
// GOOD: Fragment instantiated statically
{
getFragmentManager().beginTransaction()
.replace(com.android.internal.R.id.prefs, new MyFragment()).commit();
}
} catch (Exception e) {
}
}
}

View File

@@ -0,0 +1,4 @@
<!DOCTYPE qhelp PUBLIC "-//Semmle//qhelp//EN" "qhelp.dtd">
<qhelp>
<include src="FragmentInjection.inc.qhelp"></include>
</qhelp>

View File

@@ -0,0 +1,21 @@
/**
* @name Android fragment injection
* @description Instantiating an Android fragment from a user-provided value
* may allow a malicious application to bypass access controls, exposing the application to unintended effects.
* @kind path-problem
* @problem.severity error
* @security-severity 9.8
* @precision high
* @id java/android/fragment-injection
* @tags security
* external/cwe/cwe-470
*/
import java
import semmle.code.java.security.FragmentInjectionQuery
import DataFlow::PathGraph
from DataFlow::PathNode source, DataFlow::PathNode sink
where any(FragmentInjectionTaintConf conf).hasFlowPath(source, sink)
select sink.getNode(), source, sink, "Fragment injection from $@.", source.getNode(),
"this user input"

View File

@@ -0,0 +1,21 @@
class UnsafeActivity extends PreferenceActivity {
@Override
protected boolean isValidFragment(String fragmentName) {
// BAD: any Fragment name can be provided.
return true;
}
}
class SafeActivity extends PreferenceActivity {
@Override
protected boolean isValidFragment(String fragmentName) {
// Good: only trusted Fragment names are allowed.
return SafeFragment1.class.getName().equals(fragmentName)
|| SafeFragment2.class.getName().equals(fragmentName)
|| SafeFragment3.class.getName().equals(fragmentName);
}
}

View File

@@ -0,0 +1,4 @@
<!DOCTYPE qhelp PUBLIC "-//Semmle//qhelp//EN" "qhelp.dtd">
<qhelp>
<include src="FragmentInjection.inc.qhelp"></include>
</qhelp>

View File

@@ -0,0 +1,22 @@
/**
* @name Android fragment injection in PreferenceActivity
* @description An insecure implementation of the 'isValidFragment' method
* of the 'PreferenceActivity' class may allow a malicious application to bypass access controls,
* exposing the application to unintended effects.
* @kind problem
* @problem.severity error
* @security-severity 9.8
* @precision high
* @id java/android/fragment-injection-preference-activity
* @tags security
* external/cwe/cwe-470
*/
import java
import semmle.code.java.security.FragmentInjection
from IsValidFragmentMethod m
where m.isUnsafe()
select m,
"The 'isValidFragment' method always returns true. This makes the exported Activity $@ vulnerable to Fragment Injection.",
m.getDeclaringType(), m.getDeclaringType().getName()

View File

@@ -0,0 +1,5 @@
---
category: newQuery
---
* Two new queries, "Android fragment injection" (`java/android/fragment-injection`) and "Android fragment injection in PreferenceActivity" (`java/android/fragment-injection-preference-activity`) have been added.
These queries find exported Android activities that instantiate and host fragments created from user-provided data. Such activities are vulnerable to access control bypass and expose the Android application to unintended effects.

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0"
package="com.example.myapp">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SafePreferenceActivity" android:exported="true" />
<activity android:name=".UnsafePreferenceActivity" android:exported="true" />
<activity android:name=".UnexportedPreferenceActivity" android:exported="false" />
</application>
</manifest>

View File

@@ -0,0 +1,18 @@
import java
import semmle.code.java.security.FragmentInjection
import TestUtilities.InlineExpectationsTest
class FragmentInjectionInPreferenceActivityTest extends InlineExpectationsTest {
FragmentInjectionInPreferenceActivityTest() { this = "FragmentInjectionInPreferenceActivityTest" }
override string getARelevantTag() { result = "hasPreferenceFragmentInjection" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasPreferenceFragmentInjection" and
exists(IsValidFragmentMethod isValidFragment | isValidFragment.isUnsafe() |
isValidFragment.getLocation() = location and
element = isValidFragment.toString() and
value = ""
)
}
}

View File

@@ -0,0 +1,11 @@
import java
import semmle.code.java.security.FragmentInjectionQuery
import TestUtilities.InlineFlowTest
class Test extends InlineFlowTest {
override DataFlow::Configuration getValueFlowConfig() { none() }
override TaintTracking::Configuration getTaintFlowConfig() {
result instanceof FragmentInjectionTaintConf
}
}

View File

@@ -0,0 +1,39 @@
package com.example.myapp;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentTransaction;
public class MainActivity extends FragmentActivity {
@Override
public void onCreate(Bundle savedInstance) {
try {
super.onCreate(savedInstance);
final String fname = getIntent().getStringExtra("fname");
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Class<Fragment> fClass = (Class<Fragment>) Class.forName(fname);
ft.add(fClass.newInstance(), ""); // $ hasTaintFlow
ft.add(0, Fragment.instantiate(this, fname), null); // $ hasTaintFlow
ft.add(0, Fragment.instantiate(this, fname, null)); // $ hasTaintFlow
ft.add(0, fClass, null, ""); // $ hasTaintFlow
ft.add(0, fClass.newInstance(), ""); // $ hasTaintFlow
ft.attach(fClass.newInstance()); // $ hasTaintFlow
ft.replace(0, fClass, null); // $ hasTaintFlow
ft.replace(0, fClass.newInstance()); // $ hasTaintFlow
ft.replace(0, fClass, null, ""); // $ hasTaintFlow
ft.replace(0, fClass.newInstance(), ""); // $ hasTaintFlow
ft.add(Fragment.class.newInstance(), ""); // Safe
ft.attach(Fragment.class.newInstance()); // Safe
ft.replace(0, Fragment.class.newInstance(), ""); // Safe
} catch (Exception e) {
}
}
}

View File

@@ -0,0 +1,11 @@
package com.example.myapp;
import android.preference.PreferenceActivity;
public class SafePreferenceActivity extends PreferenceActivity {
@Override
protected boolean isValidFragment(String fragmentName) { // Safe: not all paths return true
return fragmentName.equals("MySafeFragment") || fragmentName.equals("MySafeFragment2");
}
}

View File

@@ -0,0 +1,11 @@
package com.example.myapp;
import android.preference.PreferenceActivity;
public class UnexportedPreferenceActivity extends PreferenceActivity {
@Override
protected boolean isValidFragment(String fragmentName) { // Safe: not exported
return true;
}
}

View File

@@ -0,0 +1,11 @@
package com.example.myapp;
import android.preference.PreferenceActivity;
public class UnsafePreferenceActivity extends PreferenceActivity {
@Override
protected boolean isValidFragment(String fragmentName) { // $ hasPreferenceFragmentInjection
return true;
}
}

View File

@@ -0,0 +1 @@
//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/google-android-9.0.0

View File

@@ -16,6 +16,7 @@ package android.app;
import android.annotation.Nullable;
import android.content.Context;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package android.app;
public class ListActivity extends Activity {
public void onContentChanged() {}
public void setSelection(int position) {}
public int getSelectedItemPosition() {
return 0;
}
public long getSelectedItemId() {
return 0;
}
}

View File

@@ -2,10 +2,7 @@
package android.content;
import android.content.ComponentCallbacks;
public interface ComponentCallbacks2 extends ComponentCallbacks
{
public interface ComponentCallbacks2 extends ComponentCallbacks {
static int TRIM_MEMORY_BACKGROUND = 0;
static int TRIM_MEMORY_COMPLETE = 0;
static int TRIM_MEMORY_MODERATE = 0;
@@ -13,5 +10,6 @@ public interface ComponentCallbacks2 extends ComponentCallbacks
static int TRIM_MEMORY_RUNNING_LOW = 0;
static int TRIM_MEMORY_RUNNING_MODERATE = 0;
static int TRIM_MEMORY_UI_HIDDEN = 0;
void onTrimMemory(int p0);
}

View File

@@ -0,0 +1,139 @@
/*
* Copyright (C) 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
*
* 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.preference;
import java.util.List;
import android.app.Fragment;
import android.app.ListActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.view.View;
import android.view.View.OnClickListener;
public abstract class PreferenceActivity extends ListActivity {
public static final class Header implements Parcelable {
public Header() {}
public CharSequence getTitle(Resources res) {
return null;
}
public CharSequence getSummary(Resources res) {
return null;
}
public CharSequence getBreadCrumbTitle(Resources res) {
return null;
}
public CharSequence getBreadCrumbShortTitle(Resources res) {
return null;
}
public int describeContents() {
return 0;
}
public void writeToParcel(Parcel dest, int flags) {}
public void readFromParcel(Parcel in) {}
public static final Creator<Header> CREATOR = null;
}
public void onBackPressed() {}
public boolean hasHeaders() {
return false;
}
public List<Header> getHeaders() {
return null;
}
public boolean isMultiPane() {
return false;
}
public boolean onIsMultiPane() {
return false;
}
public boolean onIsHidingHeaders() {
return false;
}
public Header onGetInitialHeader() {
return null;
}
public Header onGetNewHeader() {
return null;
}
public void onBuildHeaders(List<Header> target) {}
public void invalidateHeaders() {}
public void loadHeadersFromResource(int resid, List<Header> target) {}
public void setListFooter(View view) {}
public void onContentChanged() {}
public void onHeaderClick(Header header, int position) {}
public Intent onBuildStartFragmentIntent(String fragmentName, Bundle args, int titleRes,
int shortTitleRes) {
return null;
}
public void startWithFragment(String fragmentName, Bundle args, Fragment resultTo,
int resultRequestCode) {}
public void startWithFragment(String fragmentName, Bundle args, Fragment resultTo,
int resultRequestCode, int titleRes, int shortTitleRes) {}
public void showBreadCrumbs(CharSequence title, CharSequence shortTitle) {}
public void setParentTitle(CharSequence title, CharSequence shortTitle,
OnClickListener listener) {}
public void switchToHeader(String fragmentName, Bundle args) {}
public void switchToHeader(Header header) {}
public void startPreferenceFragment(Fragment fragment, boolean push) {}
public void startPreferencePanel(String fragmentClass, Bundle args, int titleRes,
CharSequence titleText, Fragment resultTo, int resultRequestCode) {}
public void finishPreferencePanel(Fragment caller, int resultCode, Intent resultData) {}
public void addPreferencesFromIntent(Intent intent) {}
public void addPreferencesFromResource(int preferencesResId) {}
protected boolean isValidFragment(String fragmentName) {
return false;
}
}

View File

@@ -0,0 +1,102 @@
/*
* Copyright (C) 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
*
* 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.view;
import org.xmlpull.v1.XmlPullParser;
import android.content.Context;
import android.util.AttributeSet;
public abstract class LayoutInflater {
public interface Filter {
boolean onLoadClass(Class clazz);
}
public interface Factory {
View onCreateView(String name, Context context, AttributeSet attrs);
}
public interface Factory2 extends Factory {
View onCreateView(View parent, String name, Context context, AttributeSet attrs);
}
public static LayoutInflater from(Context context) {
return null;
}
public abstract LayoutInflater cloneInContext(Context newContext);
public Context getContext() {
return null;
}
public final Factory getFactory() {
return null;
}
public final Factory2 getFactory2() {
return null;
}
public void setFactory(Factory factory) {}
public void setFactory2(Factory2 factory) {}
public void setPrivateFactory(Factory2 factory) {}
public Filter getFilter() {
return null;
}
public void setFilter(Filter filter) {}
public void setPrecompiledLayoutsEnabledForTesting(boolean enablePrecompiledLayouts) {}
public View inflate(int resource, ViewGroup root) {
return null;
}
public View inflate(XmlPullParser parser, ViewGroup root) {
return null;
}
public View inflate(int resource, ViewGroup root, boolean attachToRoot) {
return null;
}
public View inflate(XmlPullParser parser, ViewGroup root, boolean attachToRoot) {
return null;
}
public final View createView(String name, String prefix, AttributeSet attrs)
throws ClassNotFoundException {
return null;
}
public final View createView(Context viewContext, String name, String prefix, AttributeSet attrs)
throws ClassNotFoundException {
return null;
}
public View onCreateView(Context viewContext, View parent, String name, AttributeSet attrs)
throws ClassNotFoundException {
return null;
}
public final View tryCreateView(View parent, String name, Context context, AttributeSet attrs) {
return null;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,522 @@
/*
* Copyright (C) 2006 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.view;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Region;
import android.os.Bundle;
import android.util.AttributeSet;
public abstract class ViewGroup extends View {
public ViewGroup(Context context) {
super(null);
}
public ViewGroup(Context context, AttributeSet attrs) {
super(null);
}
public ViewGroup(Context context, AttributeSet attrs, int defStyleAttr) {
super(null);
}
public ViewGroup(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(null);
}
public int getDescendantFocusability() {
return 0;
}
public void setDescendantFocusability(int focusability) {}
public void requestChildFocus(View child, View focused) {}
public void focusableViewAvailable(View v) {}
public boolean showContextMenuForChild(View originalView) {
return false;
}
public final boolean isShowingContextMenuWithCoords() {
return false;
}
public boolean showContextMenuForChild(View originalView, float x, float y) {
return false;
}
public boolean dispatchActivityResult(String who, int requestCode, int resultCode, Intent data) {
return false;
}
public View focusSearch(View focused, int direction) {
return null;
}
public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) {
return false;
}
public void childHasTransientStateChanged(View child, boolean childHasTransientState) {}
public boolean hasTransientState() {
return false;
}
public boolean dispatchUnhandledMove(View focused, int direction) {
return false;
}
public void clearChildFocus(View child) {}
public void clearFocus() {}
public View getFocusedChild() {
return null;
}
public boolean hasFocus() {
return false;
}
public View findFocus() {
return null;
}
public void addFocusables(ArrayList<View> views, int direction, int focusableMode) {}
public void addKeyboardNavigationClusters(Collection<View> views, int direction) {}
public void setTouchscreenBlocksFocus(boolean touchscreenBlocksFocus) {}
public boolean getTouchscreenBlocksFocus() {
return false;
}
public void findViewsWithText(ArrayList<View> outViews, CharSequence text, int flags) {}
public View findViewByAccessibilityIdTraversal(int accessibilityId) {
return null;
}
public View findViewByAutofillIdTraversal(int autofillId) {
return null;
}
public void dispatchWindowFocusChanged(boolean hasFocus) {}
public void addTouchables(ArrayList<View> views) {}
public void makeOptionalFitsSystemWindows() {}
public void makeFrameworkOptionalFitsSystemWindows() {}
public void dispatchDisplayHint(int hint) {}
public void dispatchWindowVisibilityChanged(int visibility) {}
public void dispatchConfigurationChanged(Configuration newConfig) {}
public void recomputeViewAttributes(View child) {}
public void bringChildToFront(View child) {}
public void dispatchWindowSystemUiVisiblityChanged(int visible) {}
public void dispatchSystemUiVisibilityChanged(int visible) {}
public void dispatchPointerCaptureChanged(boolean hasCapture) {}
public void addChildrenForAccessibility(ArrayList<View> outChildren) {}
public ArrayList<View> buildTouchDispatchChildList() {
return null;
}
public void transformPointToViewLocal(float[] point, View child) {}
public void setMotionEventSplittingEnabled(boolean split) {}
public boolean isMotionEventSplittingEnabled() {
return false;
}
public boolean isTransitionGroup() {
return false;
}
public void setTransitionGroup(boolean isTransitionGroup) {}
public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {}
public boolean requestFocus(int direction, Rect previouslyFocusedRect) {
return false;
}
public boolean restoreDefaultFocus() {
return false;
}
public boolean restoreFocusInCluster(int direction) {
return false;
}
public boolean restoreFocusNotInCluster() {
return false;
}
public void dispatchStartTemporaryDetach() {}
public void dispatchFinishTemporaryDetach() {}
public void dispatchProvideContentCaptureStructure() {}
public CharSequence getAccessibilityClassName() {
return null;
}
public void notifySubtreeAccessibilityStateChanged(View child, View source, int changeType) {}
public void notifySubtreeAccessibilityStateChangedIfNeeded() {}
public boolean onNestedPrePerformAccessibilityAction(View target, int action, Bundle args) {
return false;
}
public final int getChildDrawingOrder(int drawingPosition) {
return 0;
}
public boolean getClipChildren() {
return false;
}
public void setClipChildren(boolean clipChildren) {}
public void setClipToPadding(boolean clipToPadding) {}
public boolean getClipToPadding() {
return false;
}
public void dispatchSetSelected(boolean selected) {}
public void dispatchSetActivated(boolean activated) {}
public void dispatchDrawableHotspotChanged(float x, float y) {}
public void addTransientView(View view, int index) {}
public void removeTransientView(View view) {}
public int getTransientViewCount() {
return 0;
}
public int getTransientViewIndex(int position) {
return 0;
}
public View getTransientView(int position) {
return null;
}
public void addView(View child) {}
public void addView(View child, int index) {}
public void addView(View child, int width, int height) {}
public void addView(View child, LayoutParams params) {}
public void addView(View child, int index, LayoutParams params) {}
public void updateViewLayout(View view, ViewGroup.LayoutParams params) {}
public interface OnHierarchyChangeListener {
void onChildViewAdded(View parent, View child);
void onChildViewRemoved(View parent, View child);
}
public void setOnHierarchyChangeListener(OnHierarchyChangeListener listener) {}
public void onViewAdded(View child) {}
public void onViewRemoved(View child) {}
public void removeView(View view) {}
public void removeViewInLayout(View view) {}
public void removeViewsInLayout(int start, int count) {}
public void removeViewAt(int index) {}
public void removeViews(int start, int count) {}
public void removeAllViews() {}
public void removeAllViewsInLayout() {}
public void onDescendantInvalidated(View child, View target) {}
public final void invalidateChild(View child, final Rect dirty) {}
public final void offsetDescendantRectToMyCoords(View descendant, Rect rect) {}
public final void offsetRectIntoDescendantCoords(View descendant, Rect rect) {}
public void offsetChildrenTopAndBottom(int offset) {}
public boolean getChildVisibleRect(View child, Rect r, android.graphics.Point offset) {
return false;
}
public boolean getChildVisibleRect(View child, Rect r, android.graphics.Point offset,
boolean forceParentCheck) {
return false;
}
public final void layout(int l, int t, int r, int b) {}
public void startLayoutAnimation() {}
public void scheduleLayoutAnimation() {}
public boolean isAnimationCacheEnabled() {
return false;
}
public void setAnimationCacheEnabled(boolean enabled) {}
public boolean isAlwaysDrawnWithCacheEnabled() {
return false;
}
public void setAlwaysDrawnWithCacheEnabled(boolean always) {}
public int getPersistentDrawingCache() {
return 0;
}
public void setPersistentDrawingCache(int drawingCacheToKeep) {}
public int getLayoutMode() {
return 0;
}
public void setLayoutMode(int layoutMode) {}
public LayoutParams generateLayoutParams(AttributeSet attrs) {
return null;
}
public int indexOfChild(View child) {
return 0;
}
public int getChildCount() {
return 0;
}
public View getChildAt(int index) {
return null;
}
public static int getChildMeasureSpec(int spec, int padding, int childDimension) {
return 0;
}
public void clearDisappearingChildren() {}
public void startViewTransition(View view) {}
public void endViewTransition(View view) {}
public void suppressLayout(boolean suppress) {}
public boolean isLayoutSuppressed() {
return false;
}
public boolean gatherTransparentRegion(Region region) {
return false;
}
public void requestTransparentRegion(View child) {}
public void subtractObscuredTouchableRegion(Region touchableRegion, View view) {}
public boolean hasWindowInsetsAnimationCallback() {
return false;
}
public void jumpDrawablesToCurrentState() {}
public void setAddStatesFromChildren(boolean addsStates) {}
public boolean addStatesFromChildren() {
return false;
}
public void childDrawableStateChanged(View child) {}
public boolean resolveRtlPropertiesIfNeeded() {
return false;
}
public boolean resolveLayoutDirection() {
return false;
}
public boolean resolveTextDirection() {
return false;
}
public boolean resolveTextAlignment() {
return false;
}
public void resolvePadding() {}
public void resolveLayoutParams() {}
public void resetResolvedLayoutDirection() {}
public void resetResolvedTextDirection() {}
public void resetResolvedTextAlignment() {}
public void resetResolvedPadding() {}
public boolean shouldDelayChildPressedState() {
return false;
}
public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes) {
return false;
}
public void onNestedScrollAccepted(View child, View target, int axes) {}
public void onStopNestedScroll(View child) {}
public void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed,
int dyUnconsumed) {}
public void onNestedPreScroll(View target, int dx, int dy, int[] consumed) {}
public boolean onNestedFling(View target, float velocityX, float velocityY, boolean consumed) {
return false;
}
public boolean onNestedPreFling(View target, float velocityX, float velocityY) {
return false;
}
public int getNestedScrollAxes() {
return 0;
}
public void captureTransitioningViews(List<View> transitioningViews) {}
public void findNamedViews(Map<String, View> namedElements) {}
public static class LayoutParams {
public LayoutParams(Context c, AttributeSet attrs) {}
public LayoutParams(int width, int height) {}
public LayoutParams(LayoutParams source) {}
public void resolveLayoutDirection(int layoutDirection) {}
public String debug(String output) {
return null;
}
public void onDebugDraw(View view, Canvas canvas, Paint paint) {}
}
public static class MarginLayoutParams extends ViewGroup.LayoutParams {
public MarginLayoutParams(Context c, AttributeSet attrs) {
super(null);
}
public MarginLayoutParams(int width, int height) {
super(null);
}
public MarginLayoutParams(MarginLayoutParams source) {
super(null);
}
public MarginLayoutParams(LayoutParams source) {
super(null);
}
public final void copyMarginsFrom(MarginLayoutParams source) {}
public void setMargins(int left, int top, int right, int bottom) {}
public void setMarginsRelative(int start, int top, int end, int bottom) {}
public void setMarginStart(int start) {}
public int getMarginStart() {
return 0;
}
public void setMarginEnd(int end) {}
public int getMarginEnd() {
return 0;
}
public boolean isMarginRelative() {
return false;
}
public void setLayoutDirection(int layoutDirection) {}
public int getLayoutDirection() {
return 0;
}
public void resolveLayoutDirection(int layoutDirection) {}
public boolean isLayoutRtl() {
return false;
}
public void onDebugDraw(View view, Canvas canvas, Paint paint) {}
}
public final void onDescendantUnbufferedRequested() {}
}

View File

@@ -0,0 +1,42 @@
/*
* Copyright (C) 2006 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.widget;
import android.content.Context;
import android.util.AttributeSet;
public class Button extends TextView {
public Button(Context context) {
super(null);
}
public Button(Context context, AttributeSet attrs) {
super(null);
}
public Button(Context context, AttributeSet attrs, int defStyleAttr) {
super(null);
}
public Button(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(null);
}
@Override
public CharSequence getAccessibilityClassName() {
return null;
}
}

View File

@@ -0,0 +1,816 @@
/*
* Copyright (C) 2006 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.widget;
import java.util.ArrayList;
import java.util.Locale;
import android.annotation.Nullable;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.BlendMode;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.LocaleList;
import android.os.UserHandle;
import android.util.AttributeSet;
import android.view.View;
public class TextView extends View {
public @interface XMLTypefaceAttr {
}
public @interface AutoSizeTextType {
}
public static void preloadFontCache() {}
public TextView(Context context) {
super(null);
}
public TextView(Context context, AttributeSet attrs) {
super(null);
}
public TextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(null);
}
public TextView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(null);
}
public void setAutoSizeTextTypeWithDefaults(int autoSizeTextType) {}
public void setAutoSizeTextTypeUniformWithConfiguration(int autoSizeMinTextSize,
int autoSizeMaxTextSize, int autoSizeStepGranularity, int unit) {}
public void setAutoSizeTextTypeUniformWithPresetSizes(int[] presetSizes, int unit) {}
public int getAutoSizeTextType() {
return 0;
}
public int getAutoSizeStepGranularity() {
return 0;
}
public int getAutoSizeMinTextSize() {
return 0;
}
public int getAutoSizeMaxTextSize() {
return 0;
}
public int[] getAutoSizeTextAvailableSizes() {
return null;
}
public void setTypeface(Typeface tf, int style) {}
public CharSequence getText() {
return null;
}
public int length() {
return 0;
}
public CharSequence getTransformed() {
return null;
}
public int getLineHeight() {
return 0;
}
public int getCompoundPaddingTop() {
return 0;
}
public int getCompoundPaddingBottom() {
return 0;
}
public int getCompoundPaddingLeft() {
return 0;
}
public int getCompoundPaddingRight() {
return 0;
}
public int getCompoundPaddingStart() {
return 0;
}
public int getCompoundPaddingEnd() {
return 0;
}
public int getExtendedPaddingTop() {
return 0;
}
public int getExtendedPaddingBottom() {
return 0;
}
public int getTotalPaddingLeft() {
return 0;
}
public int getTotalPaddingRight() {
return 0;
}
public int getTotalPaddingStart() {
return 0;
}
public int getTotalPaddingEnd() {
return 0;
}
public int getTotalPaddingTop() {
return 0;
}
public int getTotalPaddingBottom() {
return 0;
}
public void setCompoundDrawables(Drawable left, Drawable top, Drawable right, Drawable bottom) {}
public void setCompoundDrawablesWithIntrinsicBounds(int left, int top, int right, int bottom) {}
public void setCompoundDrawablesWithIntrinsicBounds(Drawable left, Drawable top, Drawable right,
Drawable bottom) {}
public void setCompoundDrawablesRelative(Drawable start, Drawable top, Drawable end,
Drawable bottom) {}
public void setCompoundDrawablesRelativeWithIntrinsicBounds(int start, int top, int end,
int bottom) {}
public void setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable start, Drawable top,
Drawable end, Drawable bottom) {}
public Drawable[] getCompoundDrawables() {
return null;
}
public Drawable[] getCompoundDrawablesRelative() {
return null;
}
public void setCompoundDrawablePadding(int pad) {}
public int getCompoundDrawablePadding() {
return 0;
}
public void setCompoundDrawableTintList(ColorStateList tint) {}
public ColorStateList getCompoundDrawableTintList() {
return null;
}
public void setCompoundDrawableTintMode(PorterDuff.Mode tintMode) {}
public void setCompoundDrawableTintBlendMode(BlendMode blendMode) {}
public PorterDuff.Mode getCompoundDrawableTintMode() {
return null;
}
public BlendMode getCompoundDrawableTintBlendMode() {
return null;
}
public void setFirstBaselineToTopHeight(int firstBaselineToTopHeight) {}
public void setLastBaselineToBottomHeight(int lastBaselineToBottomHeight) {}
public int getFirstBaselineToTopHeight() {
return 0;
}
public int getLastBaselineToBottomHeight() {
return 0;
}
public final int getAutoLinkMask() {
return 0;
}
public void setTextSelectHandle(Drawable textSelectHandle) {}
public void setTextSelectHandle(int textSelectHandle) {}
@Nullable
public Drawable getTextSelectHandle() {
return null;
}
public void setTextSelectHandleLeft(Drawable textSelectHandleLeft) {}
public void setTextSelectHandleLeft(int textSelectHandleLeft) {}
@Nullable
public Drawable getTextSelectHandleLeft() {
return null;
}
public void setTextSelectHandleRight(Drawable textSelectHandleRight) {}
public void setTextSelectHandleRight(int textSelectHandleRight) {}
@Nullable
public Drawable getTextSelectHandleRight() {
return null;
}
public void setTextCursorDrawable(Drawable textCursorDrawable) {}
public void setTextCursorDrawable(int textCursorDrawable) {}
@Nullable
public Drawable getTextCursorDrawable() {
return null;
}
public void setTextAppearance(int resId) {}
public void setTextAppearance(Context context, int resId) {}
public Locale getTextLocale() {
return null;
}
public LocaleList getTextLocales() {
return null;
}
public void setTextLocale(Locale locale) {}
public void setTextLocales(LocaleList locales) {}
public float getTextSize() {
return 0;
}
public float getScaledTextSize() {
return 0;
}
public int getTypefaceStyle() {
return 0;
}
public void setTextSize(float size) {}
public void setTextSize(int unit, float size) {}
public int getTextSizeUnit() {
return 0;
}
public float getTextScaleX() {
return 0;
}
public void setTextScaleX(float size) {}
public void setTypeface(Typeface tf) {}
public Typeface getTypeface() {
return null;
}
public void setElegantTextHeight(boolean elegant) {}
public void setFallbackLineSpacing(boolean enabled) {}
public boolean isFallbackLineSpacing() {
return false;
}
public boolean isElegantTextHeight() {
return false;
}
public float getLetterSpacing() {
return 0;
}
public void setLetterSpacing(float letterSpacing) {}
public String getFontFeatureSettings() {
return null;
}
public String getFontVariationSettings() {
return null;
}
public void setBreakStrategy(int breakStrategy) {}
public int getBreakStrategy() {
return 0;
}
public void setHyphenationFrequency(int hyphenationFrequency) {}
public int getHyphenationFrequency() {
return 0;
}
public void setJustificationMode(int justificationMode) {}
public int getJustificationMode() {
return 0;
}
public void setFontFeatureSettings(String fontFeatureSettings) {}
public boolean setFontVariationSettings(String fontVariationSettings) {
return false;
}
public void setTextColor(int color) {}
public void setTextColor(ColorStateList colors) {}
public final ColorStateList getTextColors() {
return null;
}
public final int getCurrentTextColor() {
return 0;
}
public void setHighlightColor(int color) {}
public int getHighlightColor() {
return 0;
}
public final void setShowSoftInputOnFocus(boolean show) {}
public final boolean getShowSoftInputOnFocus() {
return false;
}
public void setShadowLayer(float radius, float dx, float dy, int color) {}
public float getShadowRadius() {
return 0;
}
public float getShadowDx() {
return 0;
}
public float getShadowDy() {
return 0;
}
public int getShadowColor() {
return 0;
}
public final void setAutoLinkMask(int mask) {}
public final void setLinksClickable(boolean whether) {}
public final boolean getLinksClickable() {
return false;
}
public final void setHintTextColor(int color) {}
public final void setHintTextColor(ColorStateList colors) {}
public final ColorStateList getHintTextColors() {
return null;
}
public final int getCurrentHintTextColor() {
return 0;
}
public final void setLinkTextColor(int color) {}
public final void setLinkTextColor(ColorStateList colors) {}
public final ColorStateList getLinkTextColors() {
return null;
}
public void setGravity(int gravity) {}
public int getGravity() {
return 0;
}
public int getPaintFlags() {
return 0;
}
public void setPaintFlags(int flags) {}
public void setHorizontallyScrolling(boolean whether) {}
public final boolean isHorizontallyScrollable() {
return false;
}
public boolean getHorizontallyScrolling() {
return false;
}
public void setMinLines(int minLines) {}
public int getMinLines() {
return 0;
}
public void setMinHeight(int minPixels) {}
public int getMinHeight() {
return 0;
}
public void setMaxLines(int maxLines) {}
public int getMaxLines() {
return 0;
}
public void setMaxHeight(int maxPixels) {}
public int getMaxHeight() {
return 0;
}
public void setLines(int lines) {}
public void setHeight(int pixels) {}
public void setMinEms(int minEms) {}
public int getMinEms() {
return 0;
}
public void setMinWidth(int minPixels) {}
public int getMinWidth() {
return 0;
}
public void setMaxEms(int maxEms) {}
public int getMaxEms() {
return 0;
}
public void setMaxWidth(int maxPixels) {}
public int getMaxWidth() {
return 0;
}
public void setEms(int ems) {}
public void setWidth(int pixels) {}
public void setLineSpacing(float add, float mult) {}
public float getLineSpacingMultiplier() {
return 0;
}
public float getLineSpacingExtra() {
return 0;
}
public void setLineHeight(int lineHeight) {}
public final void append(CharSequence text) {}
public void append(CharSequence text, int start, int end) {}
public void setFreezesText(boolean freezesText) {}
public boolean getFreezesText() {
return false;
}
public final void setText(CharSequence text) {}
public final void setTextKeepState(CharSequence text) {}
public void setText(CharSequence text, BufferType type) {}
public final void setText(char[] text, int start, int len) {}
public final void setTextKeepState(CharSequence text, BufferType type) {}
public final void setText(int resid) {}
public final void setText(int resid, BufferType type) {}
public final void setHint(CharSequence hint) {}
public final void setHint(int resid) {}
public CharSequence getHint() {
return null;
}
public boolean isSingleLine() {
return false;
}
public void setInputType(int type) {}
public boolean isAnyPasswordInputType() {
return false;
}
public void setRawInputType(int type) {}
public int getInputType() {
return 0;
}
public void setImeOptions(int imeOptions) {}
public int getImeOptions() {
return 0;
}
public void setImeActionLabel(CharSequence label, int actionId) {}
public CharSequence getImeActionLabel() {
return null;
}
public int getImeActionId() {
return 0;
}
public void onEditorAction(int actionCode) {}
public void setPrivateImeOptions(String type) {}
public String getPrivateImeOptions() {
return null;
}
public Bundle getInputExtras(boolean create) {
return null;
}
public void setImeHintLocales(LocaleList hintLocales) {}
public LocaleList getImeHintLocales() {
return null;
}
public CharSequence getError() {
return null;
}
public void setError(CharSequence error) {}
public void setError(CharSequence error, Drawable icon) {}
public boolean isTextSelectable() {
return false;
}
public void setTextIsSelectable(boolean selectable) {}
public int getHorizontalOffsetForDrawables() {
return 0;
}
public int getLineCount() {
return 0;
}
public int getLineBounds(int line, Rect bounds) {
return 0;
}
public int getBaseline() {
return 0;
}
public void resetErrorChangedFlag() {}
public void hideErrorIfUnchanged() {}
public boolean onCheckIsTextEditor() {
return false;
}
public void beginBatchEdit() {}
public void endBatchEdit() {}
public void onBeginBatchEdit() {}
public void onEndBatchEdit() {}
public boolean onPrivateIMECommand(String action, Bundle data) {
return false;
}
public void nullLayouts() {}
public boolean useDynamicLayout() {
return false;
}
public void setIncludeFontPadding(boolean includepad) {}
public boolean getIncludeFontPadding() {
return false;
}
public boolean bringPointIntoView(int offset) {
return false;
}
public boolean moveCursorToVisibleOffset() {
return false;
}
public void computeScroll() {}
public void debug(int depth) {}
public int getSelectionStart() {
return 0;
}
public int getSelectionEnd() {
return 0;
}
public boolean hasSelection() {
return false;
}
public void setSingleLine() {}
public void setAllCaps(boolean allCaps) {}
public boolean isAllCaps() {
return false;
}
public void setSingleLine(boolean singleLine) {}
public void setMarqueeRepeatLimit(int marqueeLimit) {}
public int getMarqueeRepeatLimit() {
return 0;
}
public void setSelectAllOnFocus(boolean selectAllOnFocus) {}
public void setCursorVisible(boolean visible) {}
public boolean isCursorVisible() {
return false;
}
public void onWindowFocusChanged(boolean hasWindowFocus) {}
public void clearComposingText() {}
public void setSelected(boolean selected) {}
public boolean showContextMenu() {
return false;
}
public boolean showContextMenu(float x, float y) {
return false;
}
public boolean didTouchFocusSelect() {
return false;
}
public void cancelLongPress() {}
public void findViewsWithText(ArrayList<View> outViews, CharSequence searched, int flags) {}
public enum BufferType {
}
public static ColorStateList getTextColors(Context context, TypedArray attrs) {
return null;
}
public static int getTextColor(Context context, TypedArray attrs, int def) {
return 0;
}
public final void setTextOperationUser(UserHandle user) {}
public Locale getTextServicesLocale() {
return null;
}
public boolean isInExtractedMode() {
return false;
}
public Locale getSpellCheckerLocale() {
return null;
}
public CharSequence getAccessibilityClassName() {
return null;
}
public boolean isPositionVisible(final float positionX, final float positionY) {
return false;
}
public boolean performAccessibilityActionInternal(int action, Bundle arguments) {
return false;
}
public void sendAccessibilityEventInternal(int eventType) {}
public boolean isInputMethodTarget() {
return false;
}
public boolean onTextContextMenuItem(int id) {
return false;
}
public boolean performLongClick() {
return false;
}
public boolean isSuggestionsEnabled() {
return false;
}
public void hideFloatingToolbar(int durationMs) {}
public int getOffsetForPosition(float x, float y) {
return 0;
}
public void onRtlPropertiesChanged(int layoutDirection) {}
public void onResolveDrawables(int layoutDirection) {}
public CharSequence getIterableTextForAccessibility() {
return null;
}
public int getAccessibilitySelectionStart() {
return 0;
}
public boolean isAccessibilitySelectionExtendable() {
return false;
}
public int getAccessibilitySelectionEnd() {
return 0;
}
public void setAccessibilitySelection(int start, int end) {}
}

View File

@@ -0,0 +1,71 @@
/*
* Copyright 2018 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 androidx.activity;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.os.Bundle;
import android.view.View;
public class ComponentActivity extends androidx.core.app.ComponentActivity {
public ComponentActivity() {}
public ComponentActivity(int contentLayoutId) {}
public final Object onRetainNonConfigurationInstance() {
return null;
}
public Object onRetainCustomNonConfigurationInstance() {
return null;
}
public Object getLastCustomNonConfigurationInstance() {
return null;
}
@Override
public void setContentView(int layoutResID) {}
@Override
public void setContentView(View view) {}
public Context peekAvailableContext() {
return null;
}
public void onBackPressed() {}
@Override
public void startActivityForResult(Intent intent, int requestCode) {}
public void startActivityForResult(Intent intent, int requestCode, Bundle options) {}
public void startIntentSenderForResult(IntentSender intent, int requestCode, Intent fillInIntent,
int flagsMask, int flagsValues, int extraFlags) throws IntentSender.SendIntentException {}
public void startIntentSenderForResult(IntentSender intent, int requestCode, Intent fillInIntent,
int flagsMask, int flagsValues, int extraFlags, Bundle options)
throws IntentSender.SendIntentException {}
public void onRequestPermissionsResult(int requestCode, String[] permissions,
int[] grantResults) {}
public void reportFullyDrawn() {}
}

View File

@@ -0,0 +1,29 @@
/*
* 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 androidx.core.app;
import android.app.Activity;
public class ComponentActivity extends Activity {
public void putExtraData(ExtraData extraData) {}
public <T extends ExtraData> T getExtraData(Class<T> extraDataClass) {
return null;
}
public static class ExtraData {
}
}

View File

@@ -0,0 +1,83 @@
/*
* Copyright 2018 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 androidx.fragment.app;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.View;
import androidx.activity.ComponentActivity;
public class FragmentActivity extends ComponentActivity {
public FragmentActivity() {}
public FragmentActivity(int contentLayoutId) {}
public void supportFinishAfterTransition() {}
public void supportPostponeEnterTransition() {}
public void supportStartPostponedEnterTransition() {}
public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {}
public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode) {}
public void onConfigurationChanged(Configuration newConfig) {}
public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
return null;
}
public View onCreateView(String name, Context context, AttributeSet attrs) {
return null;
}
public void onLowMemory() {}
public void onStateNotSaved() {}
public void supportInvalidateOptionsMenu() {}
public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {}
public void onAttachFragment(Fragment fragment) {}
public FragmentManager getSupportFragmentManager() {
return null;
}
public final void validateRequestPermissionsRequestCode(int requestCode) {}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions,
int[] grantResults) {}
public void startActivityFromFragment(Fragment fragment, Intent intent, int requestCode) {}
public void startActivityFromFragment(Fragment fragment, Intent intent, int requestCode,
Bundle options) {}
public void startIntentSenderFromFragment(Fragment fragment, IntentSender intent,
int requestCode, Intent fillInIntent, int flagsMask, int flagsValues,
int extraFlags, Bundle options) throws IntentSender.SendIntentException {}
}

View File

@@ -0,0 +1,160 @@
/*
* Copyright 2018 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 androidx.fragment.app;
import java.util.List;
import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
public abstract class FragmentManager {
public static void enableDebugLogging(boolean enabled) {}
public static boolean isLoggingEnabled(int level) {
return false;
}
public interface BackStackEntry {
int getId();
String getName();
int getBreadCrumbTitleRes();
int getBreadCrumbShortTitleRes();
CharSequence getBreadCrumbTitle();
CharSequence getBreadCrumbShortTitle();
}
public interface OnBackStackChangedListener {
void onBackStackChanged();
}
public abstract static class FragmentLifecycleCallbacks {
public void onFragmentPreAttached(FragmentManager fm, Fragment f, Context context) {}
public void onFragmentAttached(FragmentManager fm, Fragment f, Context context) {}
public void onFragmentPreCreated(FragmentManager fm, Fragment f, Bundle savedInstanceState) {}
public void onFragmentCreated(FragmentManager fm, Fragment f, Bundle savedInstanceState) {}
public void onFragmentActivityCreated(FragmentManager fm, Fragment f,
Bundle savedInstanceState) {}
public void onFragmentViewCreated(FragmentManager fm, Fragment f, View v,
Bundle savedInstanceState) {}
public void onFragmentStarted(FragmentManager fm, Fragment f) {}
public void onFragmentResumed(FragmentManager fm, Fragment f) {}
public void onFragmentPaused(FragmentManager fm, Fragment f) {}
public void onFragmentStopped(FragmentManager fm, Fragment f) {}
public void onFragmentSaveInstanceState(FragmentManager fm, Fragment f, Bundle outState) {}
public void onFragmentViewDestroyed(FragmentManager fm, Fragment f) {}
public void onFragmentDestroyed(FragmentManager fm, Fragment f) {}
public void onFragmentDetached(FragmentManager fm, Fragment f) {}
}
public FragmentTransaction openTransaction() {
return null;
}
public FragmentTransaction beginTransaction() {
return null;
}
public boolean executePendingTransactions() {
return false;
}
public void restoreBackStack(String name) {}
public void saveBackStack(String name) {}
public void popBackStack() {}
public boolean popBackStackImmediate() {
return false;
}
public void popBackStack(final String name, final int flags) {}
public boolean popBackStackImmediate(String name, int flags) {
return false;
}
public void popBackStack(final int id, final int flags) {}
public boolean popBackStackImmediate(int id, int flags) {
return false;
}
public int getBackStackEntryCount() {
return 0;
}
public BackStackEntry getBackStackEntryAt(int index) {
return null;
}
public void addOnBackStackChangedListener(OnBackStackChangedListener listener) {}
public void removeOnBackStackChangedListener(OnBackStackChangedListener listener) {}
public final void setFragmentResult(String requestKey, Bundle result) {}
public final void clearFragmentResult(String requestKey) {}
public final void clearFragmentResultListener(String requestKey) {}
public void putFragment(Bundle bundle, String key, Fragment fragment) {}
public Fragment getFragment(Bundle bundle, String key) {
return null;
}
public static <F extends Fragment> F findFragment(View view) {
return null;
}
public List<Fragment> getFragments() {
return null;
}
public Fragment.SavedState saveFragmentInstanceState(Fragment fragment) {
return null;
}
public boolean isDestroyed() {
return false;
}
@Override
public String toString() {
return null;
}
}

View File

@@ -0,0 +1,165 @@
/*
* Copyright 2018 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 androidx.fragment.app;
import android.app.Fragment;
import android.os.Bundle;
import android.view.View;
public abstract class FragmentTransaction {
public FragmentTransaction() {}
public final FragmentTransaction add(Class<? extends Fragment> fragmentClass, Bundle args,
String tag) {
return null;
}
public FragmentTransaction add(Fragment fragment, String tag) {
return null;
}
public final FragmentTransaction add(int containerViewId, Class<? extends Fragment> fragmentClass,
Bundle args) {
return null;
}
public FragmentTransaction add(int containerViewId, Fragment fragment) {
return null;
}
public final FragmentTransaction add(int containerViewId, Class<? extends Fragment> fragmentClass,
Bundle args, String tag) {
return null;
}
public FragmentTransaction add(int containerViewId, Fragment fragment, String tag) {
return null;
}
public final FragmentTransaction replace(int containerViewId,
Class<? extends Fragment> fragmentClass, Bundle args) {
return null;
}
public FragmentTransaction replace(int containerViewId, Fragment fragment) {
return null;
}
public final FragmentTransaction replace(int containerViewId,
Class<? extends Fragment> fragmentClass, Bundle args, String tag) {
return null;
}
public FragmentTransaction replace(int containerViewId, Fragment fragment, String tag) {
return null;
}
public FragmentTransaction remove(Fragment fragment) {
return null;
}
public FragmentTransaction hide(Fragment fragment) {
return null;
}
public FragmentTransaction show(Fragment fragment) {
return null;
}
public FragmentTransaction detach(Fragment fragment) {
return null;
}
public FragmentTransaction attach(Fragment fragment) {
return null;
}
public FragmentTransaction setPrimaryNavigationFragment(Fragment fragment) {
return null;
}
public boolean isEmpty() {
return false;
}
public FragmentTransaction setCustomAnimations(int enter, int exit) {
return null;
}
public FragmentTransaction setCustomAnimations(int enter, int exit, int popEnter, int popExit) {
return null;
}
public FragmentTransaction addSharedElement(View sharedElement, String name) {
return null;
}
public FragmentTransaction setTransition(int transition) {
return null;
}
public FragmentTransaction setTransitionStyle(int styleRes) {
return null;
}
public FragmentTransaction addToBackStack(String name) {
return null;
}
public boolean isAddToBackStackAllowed() {
return false;
}
public FragmentTransaction disallowAddToBackStack() {
return null;
}
public FragmentTransaction setBreadCrumbTitle(int res) {
return null;
}
public FragmentTransaction setBreadCrumbTitle(CharSequence text) {
return null;
}
public FragmentTransaction setBreadCrumbShortTitle(int res) {
return null;
}
public FragmentTransaction setBreadCrumbShortTitle(CharSequence text) {
return null;
}
public FragmentTransaction setReorderingAllowed(boolean reorderingAllowed) {
return null;
}
public FragmentTransaction setAllowOptimization(boolean allowOptimization) {
return null;
}
public FragmentTransaction runOnCommit(Runnable runnable) {
return null;
}
public abstract int commit();
public abstract int commitAllowingStateLoss();
public abstract void commitNow();
public abstract void commitNowAllowingStateLoss();
}