Merge "Address code warnings in the android.app package."
This commit is contained in:
@@ -959,7 +959,7 @@ public class Activity extends ContextThemeWrapper
|
|||||||
private int mDefaultKeyMode = DEFAULT_KEYS_DISABLE;
|
private int mDefaultKeyMode = DEFAULT_KEYS_DISABLE;
|
||||||
private SpannableStringBuilder mDefaultKeySsb = null;
|
private SpannableStringBuilder mDefaultKeySsb = null;
|
||||||
|
|
||||||
private ActivityManager.TaskDescription mTaskDescription =
|
private final ActivityManager.TaskDescription mTaskDescription =
|
||||||
new ActivityManager.TaskDescription();
|
new ActivityManager.TaskDescription();
|
||||||
|
|
||||||
protected static final int[] FOCUSED_STATE_SET = {com.android.internal.R.attr.state_focused};
|
protected static final int[] FOCUSED_STATE_SET = {com.android.internal.R.attr.state_focused};
|
||||||
@@ -970,7 +970,7 @@ public class Activity extends ContextThemeWrapper
|
|||||||
private Thread mUiThread;
|
private Thread mUiThread;
|
||||||
|
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
ActivityTransitionState mActivityTransitionState = new ActivityTransitionState();
|
final ActivityTransitionState mActivityTransitionState = new ActivityTransitionState();
|
||||||
SharedElementCallback mEnterTransitionListener = SharedElementCallback.NULL_CALLBACK;
|
SharedElementCallback mEnterTransitionListener = SharedElementCallback.NULL_CALLBACK;
|
||||||
SharedElementCallback mExitTransitionListener = SharedElementCallback.NULL_CALLBACK;
|
SharedElementCallback mExitTransitionListener = SharedElementCallback.NULL_CALLBACK;
|
||||||
|
|
||||||
@@ -1839,7 +1839,7 @@ public class Activity extends ContextThemeWrapper
|
|||||||
final int numDialogs = ids.length;
|
final int numDialogs = ids.length;
|
||||||
mManagedDialogs = new SparseArray<ManagedDialog>(numDialogs);
|
mManagedDialogs = new SparseArray<ManagedDialog>(numDialogs);
|
||||||
for (int i = 0; i < numDialogs; i++) {
|
for (int i = 0; i < numDialogs; i++) {
|
||||||
final Integer dialogId = ids[i];
|
final int dialogId = ids[i];
|
||||||
Bundle dialogState = b.getBundle(savedDialogKeyFor(dialogId));
|
Bundle dialogState = b.getBundle(savedDialogKeyFor(dialogId));
|
||||||
if (dialogState != null) {
|
if (dialogState != null) {
|
||||||
// Calling onRestoreInstanceState() below will invoke dispatchOnCreate
|
// Calling onRestoreInstanceState() below will invoke dispatchOnCreate
|
||||||
@@ -1909,7 +1909,7 @@ public class Activity extends ContextThemeWrapper
|
|||||||
* <code>persistAcrossReboots</code>.
|
* <code>persistAcrossReboots</code>.
|
||||||
*
|
*
|
||||||
* @param savedInstanceState The data most recently supplied in {@link #onSaveInstanceState}
|
* @param savedInstanceState The data most recently supplied in {@link #onSaveInstanceState}
|
||||||
* @param persistentState The data caming from the PersistableBundle first
|
* @param persistentState The data coming from the PersistableBundle first
|
||||||
* saved in {@link #onSaveInstanceState(Bundle, PersistableBundle)}.
|
* saved in {@link #onSaveInstanceState(Bundle, PersistableBundle)}.
|
||||||
*
|
*
|
||||||
* @see #onCreate
|
* @see #onCreate
|
||||||
@@ -5058,7 +5058,7 @@ public class Activity extends ContextThemeWrapper
|
|||||||
* This hook is called when the user signals the desire to start a search.
|
* This hook is called when the user signals the desire to start a search.
|
||||||
*
|
*
|
||||||
* <p>You can use this function as a simple way to launch the search UI, in response to a
|
* <p>You can use this function as a simple way to launch the search UI, in response to a
|
||||||
* menu item, search button, or other widgets within your activity. Unless overidden,
|
* menu item, search button, or other widgets within your activity. Unless overridden,
|
||||||
* calling this function is the same as calling
|
* calling this function is the same as calling
|
||||||
* {@link #startSearch startSearch(null, false, null, false)}, which launches
|
* {@link #startSearch startSearch(null, false, null, false)}, which launches
|
||||||
* search for the current activity as specified in its manifest, see {@link SearchManager}.
|
* search for the current activity as specified in its manifest, see {@link SearchManager}.
|
||||||
@@ -8797,7 +8797,7 @@ public class Activity extends ContextThemeWrapper
|
|||||||
* @see Activity#convertFromTranslucent()
|
* @see Activity#convertFromTranslucent()
|
||||||
* @see Activity#convertToTranslucent(TranslucentConversionListener, ActivityOptions)
|
* @see Activity#convertToTranslucent(TranslucentConversionListener, ActivityOptions)
|
||||||
*/
|
*/
|
||||||
public void onTranslucentConversionComplete(boolean drawComplete);
|
void onTranslucentConversionComplete(boolean drawComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dispatchRequestPermissionsResult(int requestCode, Intent data) {
|
private void dispatchRequestPermissionsResult(int requestCode, Intent data) {
|
||||||
@@ -8920,7 +8920,7 @@ public class Activity extends ContextThemeWrapper
|
|||||||
/**
|
/**
|
||||||
* Registers remote animations per transition type for this activity.
|
* Registers remote animations per transition type for this activity.
|
||||||
*
|
*
|
||||||
* @param definition The remote animation definition that defines which transition whould run
|
* @param definition The remote animation definition that defines which transition would run
|
||||||
* which remote animation.
|
* which remote animation.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -266,7 +266,6 @@ public final class ActivityThread extends ClientTransactionHandler
|
|||||||
implements ActivityThreadInternal {
|
implements ActivityThreadInternal {
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static final String TAG = "ActivityThread";
|
public static final String TAG = "ActivityThread";
|
||||||
private static final android.graphics.Bitmap.Config THUMBNAIL_FORMAT = Bitmap.Config.RGB_565;
|
|
||||||
static final boolean localLOGV = false;
|
static final boolean localLOGV = false;
|
||||||
static final boolean DEBUG_MESSAGES = false;
|
static final boolean DEBUG_MESSAGES = false;
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@@ -368,7 +367,7 @@ public final class ActivityThread extends ClientTransactionHandler
|
|||||||
private final AtomicInteger mNumLaunchingActivities = new AtomicInteger();
|
private final AtomicInteger mNumLaunchingActivities = new AtomicInteger();
|
||||||
@GuardedBy("mAppThread")
|
@GuardedBy("mAppThread")
|
||||||
private int mLastProcessState = PROCESS_STATE_UNKNOWN;
|
private int mLastProcessState = PROCESS_STATE_UNKNOWN;
|
||||||
ArrayList<WeakReference<AssistStructure>> mLastAssistStructures = new ArrayList<>();
|
final ArrayList<WeakReference<AssistStructure>> mLastAssistStructures = new ArrayList<>();
|
||||||
private int mLastSessionId;
|
private int mLastSessionId;
|
||||||
final ArrayMap<IBinder, CreateServiceData> mServicesData = new ArrayMap<>();
|
final ArrayMap<IBinder, CreateServiceData> mServicesData = new ArrayMap<>();
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
@@ -564,7 +563,7 @@ public final class ActivityThread extends ClientTransactionHandler
|
|||||||
Configuration createdConfig;
|
Configuration createdConfig;
|
||||||
Configuration overrideConfig;
|
Configuration overrideConfig;
|
||||||
// Used for consolidating configs before sending on to Activity.
|
// Used for consolidating configs before sending on to Activity.
|
||||||
private Configuration tmpConfig = new Configuration();
|
private final Configuration tmpConfig = new Configuration();
|
||||||
// Callback used for updating activity override config and camera compat control state.
|
// Callback used for updating activity override config and camera compat control state.
|
||||||
ViewRootImpl.ActivityConfigCallback activityConfigCallback;
|
ViewRootImpl.ActivityConfigCallback activityConfigCallback;
|
||||||
ActivityClientRecord nextIdle;
|
ActivityClientRecord nextIdle;
|
||||||
@@ -769,7 +768,7 @@ public final class ActivityThread extends ClientTransactionHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final class ProviderClientRecord {
|
static final class ProviderClientRecord {
|
||||||
final String[] mNames;
|
final String[] mNames;
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
final IContentProvider mProvider;
|
final IContentProvider mProvider;
|
||||||
@@ -796,7 +795,7 @@ public final class ActivityThread extends ClientTransactionHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
Intent intent;
|
final Intent intent;
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
ActivityInfo info;
|
ActivityInfo info;
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
@@ -3336,11 +3335,8 @@ public final class ActivityThread extends ClientTransactionHandler
|
|||||||
public void registerOnActivityPausedListener(Activity activity,
|
public void registerOnActivityPausedListener(Activity activity,
|
||||||
OnActivityPausedListener listener) {
|
OnActivityPausedListener listener) {
|
||||||
synchronized (mOnPauseListeners) {
|
synchronized (mOnPauseListeners) {
|
||||||
ArrayList<OnActivityPausedListener> list = mOnPauseListeners.get(activity);
|
ArrayList<OnActivityPausedListener> list =
|
||||||
if (list == null) {
|
mOnPauseListeners.computeIfAbsent(activity, k -> new ArrayList<>());
|
||||||
list = new ArrayList<OnActivityPausedListener>();
|
|
||||||
mOnPauseListeners.put(activity, list);
|
|
||||||
}
|
|
||||||
list.add(listener);
|
list.add(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5400,7 +5396,7 @@ public final class ActivityThread extends ClientTransactionHandler
|
|||||||
/** Core implementation of activity destroy call. */
|
/** Core implementation of activity destroy call. */
|
||||||
void performDestroyActivity(ActivityClientRecord r, boolean finishing,
|
void performDestroyActivity(ActivityClientRecord r, boolean finishing,
|
||||||
int configChanges, boolean getNonConfigInstance, String reason) {
|
int configChanges, boolean getNonConfigInstance, String reason) {
|
||||||
Class<? extends Activity> activityClass = null;
|
Class<? extends Activity> activityClass;
|
||||||
if (localLOGV) Slog.v(TAG, "Performing finish of " + r);
|
if (localLOGV) Slog.v(TAG, "Performing finish of " + r);
|
||||||
activityClass = r.activity.getClass();
|
activityClass = r.activity.getClass();
|
||||||
r.activity.mConfigChangeFlags |= configChanges;
|
r.activity.mConfigChangeFlags |= configChanges;
|
||||||
@@ -7051,7 +7047,7 @@ public final class ActivityThread extends ClientTransactionHandler
|
|||||||
// Note that we cannot hold the lock while acquiring and installing the
|
// Note that we cannot hold the lock while acquiring and installing the
|
||||||
// provider since it might take a long time to run and it could also potentially
|
// provider since it might take a long time to run and it could also potentially
|
||||||
// be re-entrant in the case where the provider is in the same process.
|
// be re-entrant in the case where the provider is in the same process.
|
||||||
ContentProviderHolder holder = null;
|
ContentProviderHolder holder;
|
||||||
final ProviderKey key = getGetProviderKey(auth, userId);
|
final ProviderKey key = getGetProviderKey(auth, userId);
|
||||||
try {
|
try {
|
||||||
synchronized (key) {
|
synchronized (key) {
|
||||||
@@ -7105,11 +7101,7 @@ public final class ActivityThread extends ClientTransactionHandler
|
|||||||
private ProviderKey getGetProviderKey(String auth, int userId) {
|
private ProviderKey getGetProviderKey(String auth, int userId) {
|
||||||
final ProviderKey key = new ProviderKey(auth, userId);
|
final ProviderKey key = new ProviderKey(auth, userId);
|
||||||
synchronized (mGetProviderKeys) {
|
synchronized (mGetProviderKeys) {
|
||||||
ProviderKey lock = mGetProviderKeys.get(key);
|
ProviderKey lock = mGetProviderKeys.computeIfAbsent(key, k -> k);
|
||||||
if (lock == null) {
|
|
||||||
lock = key;
|
|
||||||
mGetProviderKeys.put(key, lock);
|
|
||||||
}
|
|
||||||
return lock;
|
return lock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7744,7 +7736,7 @@ public final class ActivityThread extends ClientTransactionHandler
|
|||||||
if (!DEPRECATE_DATA_COLUMNS) return;
|
if (!DEPRECATE_DATA_COLUMNS) return;
|
||||||
|
|
||||||
// Install interception and make sure it sticks!
|
// Install interception and make sure it sticks!
|
||||||
Os def = null;
|
Os def;
|
||||||
do {
|
do {
|
||||||
def = Os.getDefault();
|
def = Os.getDefault();
|
||||||
} while (!Os.compareAndSetDefault(def, new AndroidOs(def)));
|
} while (!Os.compareAndSetDefault(def, new AndroidOs(def)));
|
||||||
|
|||||||
@@ -16,9 +16,6 @@
|
|||||||
|
|
||||||
package android.app;
|
package android.app;
|
||||||
|
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
@@ -29,13 +26,16 @@ import android.util.Xml;
|
|||||||
|
|
||||||
import com.android.internal.util.XmlUtils;
|
import com.android.internal.util.XmlUtils;
|
||||||
|
|
||||||
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stub activity that launches another activity (and then finishes itself)
|
* Stub activity that launches another activity (and then finishes itself)
|
||||||
* based on information in its component's manifest meta-data. This is a
|
* based on information in its component's manifest meta-data. This is a
|
||||||
* simple way to implement an alias-like mechanism.
|
* simple way to implement an alias-like mechanism.
|
||||||
*
|
*
|
||||||
* To use this activity, you should include in the manifest for the associated
|
* To use this activity, you should include in the manifest for the associated
|
||||||
* component an entry named "android.app.alias". It is a reference to an XML
|
* component an entry named "android.app.alias". It is a reference to an XML
|
||||||
* resource describing an intent that launches the real application.
|
* resource describing an intent that launches the real application.
|
||||||
@@ -51,11 +51,11 @@ public class AliasActivity extends Activity {
|
|||||||
* {@hide}
|
* {@hide}
|
||||||
*/
|
*/
|
||||||
public final String ALIAS_META_DATA = "android.app.alias";
|
public final String ALIAS_META_DATA = "android.app.alias";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
XmlResourceParser parser = null;
|
XmlResourceParser parser = null;
|
||||||
try {
|
try {
|
||||||
ActivityInfo ai = getPackageManager().getActivityInfo(
|
ActivityInfo ai = getPackageManager().getActivityInfo(
|
||||||
@@ -66,21 +66,17 @@ public class AliasActivity extends Activity {
|
|||||||
throw new RuntimeException("Alias requires a meta-data field "
|
throw new RuntimeException("Alias requires a meta-data field "
|
||||||
+ ALIAS_META_DATA);
|
+ ALIAS_META_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent intent = parseAlias(parser);
|
Intent intent = parseAlias(parser);
|
||||||
if (intent == null) {
|
if (intent == null) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
"No <intent> tag found in alias description");
|
"No <intent> tag found in alias description");
|
||||||
}
|
}
|
||||||
|
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException | XmlPullParserException | IOException e) {
|
||||||
throw new RuntimeException("Error parsing alias", e);
|
|
||||||
} catch (XmlPullParserException e) {
|
|
||||||
throw new RuntimeException("Error parsing alias", e);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException("Error parsing alias", e);
|
throw new RuntimeException("Error parsing alias", e);
|
||||||
} finally {
|
} finally {
|
||||||
if (parser != null) parser.close();
|
if (parser != null) parser.close();
|
||||||
@@ -90,21 +86,21 @@ public class AliasActivity extends Activity {
|
|||||||
private Intent parseAlias(XmlPullParser parser)
|
private Intent parseAlias(XmlPullParser parser)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
AttributeSet attrs = Xml.asAttributeSet(parser);
|
AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||||
|
|
||||||
Intent intent = null;
|
Intent intent = null;
|
||||||
|
|
||||||
int type;
|
int type;
|
||||||
while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
|
while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
|
||||||
&& type != XmlPullParser.START_TAG) {
|
&& type != XmlPullParser.START_TAG) {
|
||||||
}
|
}
|
||||||
|
|
||||||
String nodeName = parser.getName();
|
String nodeName = parser.getName();
|
||||||
if (!"alias".equals(nodeName)) {
|
if (!"alias".equals(nodeName)) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
"Alias meta-data must start with <alias> tag; found"
|
"Alias meta-data must start with <alias> tag; found"
|
||||||
+ nodeName + " at " + parser.getPositionDescription());
|
+ nodeName + " at " + parser.getPositionDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
int outerDepth = parser.getDepth();
|
int outerDepth = parser.getDepth();
|
||||||
while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
|
while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
|
||||||
&& (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
|
&& (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
|
||||||
@@ -120,8 +116,8 @@ public class AliasActivity extends Activity {
|
|||||||
XmlUtils.skipCurrentTag(parser);
|
XmlUtils.skipCurrentTag(parser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return intent;
|
return intent;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -535,7 +535,7 @@ public final class SearchableInfo implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public static SearchableInfo getActivityMetaData(Context context, ActivityInfo activityInfo,
|
public static SearchableInfo getActivityMetaData(Context context, ActivityInfo activityInfo,
|
||||||
int userId) {
|
int userId) {
|
||||||
Context userContext = null;
|
Context userContext;
|
||||||
try {
|
try {
|
||||||
userContext = context.createPackageContextAsUser("system", 0,
|
userContext = context.createPackageContextAsUser("system", 0,
|
||||||
new UserHandle(userId));
|
new UserHandle(userId));
|
||||||
|
|||||||
@@ -1629,7 +1629,6 @@ public class WallpaperManager {
|
|||||||
mContext.getUserId());
|
mContext.getUserId());
|
||||||
if (fd != null) {
|
if (fd != null) {
|
||||||
FileOutputStream fos = null;
|
FileOutputStream fos = null;
|
||||||
boolean ok = false;
|
|
||||||
try {
|
try {
|
||||||
fos = new ParcelFileDescriptor.AutoCloseOutputStream(fd);
|
fos = new ParcelFileDescriptor.AutoCloseOutputStream(fd);
|
||||||
copyStreamToWallpaperFile(resources.openRawResource(resid), fos);
|
copyStreamToWallpaperFile(resources.openRawResource(resid), fos);
|
||||||
|
|||||||
Reference in New Issue
Block a user