Remove deprecated api. Aptly rename freeStorageWithIntent to freeStorage.
This commit is contained in:
@@ -2358,22 +2358,13 @@ class ApplicationContext extends Context {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void freeStorage(long freeStorageSize, PendingIntent pi) {
|
||||
public void freeStorage(long freeStorageSize, IntentSender pi) {
|
||||
try {
|
||||
mPM.freeStorage(freeStorageSize, pi);
|
||||
} catch (RemoteException e) {
|
||||
// Should never happen!
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void freeStorageWithIntent(long freeStorageSize, IntentSender pi) {
|
||||
try {
|
||||
mPM.freeStorageWithIntent(freeStorageSize, pi);
|
||||
} catch (RemoteException e) {
|
||||
// Should never happen!
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getPackageSizeInfo(String packageName,
|
||||
|
||||
@@ -34,7 +34,6 @@ import android.content.pm.PermissionInfo;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.content.pm.ServiceInfo;
|
||||
import android.net.Uri;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.IntentSender;
|
||||
|
||||
/**
|
||||
@@ -218,30 +217,6 @@ interface IPackageManager {
|
||||
void freeStorageAndNotify(in long freeStorageSize,
|
||||
IPackageDataObserver observer);
|
||||
|
||||
/**
|
||||
* Free storage by deleting LRU sorted list of cache files across
|
||||
* all applications. If the currently available free storage
|
||||
* on the device is greater than or equal to the requested
|
||||
* free storage, no cache files are cleared. If the currently
|
||||
* available storage on the device is less than the requested
|
||||
* free storage, some or all of the cache files across
|
||||
* all applications are deleted (based on last accessed time)
|
||||
* to increase the free storage space on the device to
|
||||
* the requested value. There is no guarantee that clearing all
|
||||
* the cache files from all applications will clear up
|
||||
* enough storage to achieve the desired value.
|
||||
* @param freeStorageSize The number of bytes of storage to be
|
||||
* freed by the system. Say if freeStorageSize is XX,
|
||||
* and the current free storage is YY,
|
||||
* if XX is less than YY, just return. if not free XX-YY number
|
||||
* of bytes if possible.
|
||||
* @param opFinishedIntent PendingIntent call back used to
|
||||
* notify when the operation is completed.May be null
|
||||
* to indicate that no call back is desired.
|
||||
*/
|
||||
void freeStorage(in long freeStorageSize,
|
||||
in PendingIntent opFinishedIntent);
|
||||
|
||||
/**
|
||||
* Free storage by deleting LRU sorted list of cache files across
|
||||
* all applications. If the currently available free storage
|
||||
@@ -263,7 +238,7 @@ interface IPackageManager {
|
||||
* notify when the operation is completed.May be null
|
||||
* to indicate that no call back is desired.
|
||||
*/
|
||||
void freeStorageWithIntent(in long freeStorageSize,
|
||||
void freeStorage(in long freeStorageSize,
|
||||
in IntentSender pi);
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package android.content.pm;
|
||||
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -1501,33 +1499,6 @@ public abstract class PackageManager {
|
||||
*/
|
||||
public abstract void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer);
|
||||
|
||||
/**
|
||||
* Free storage by deleting LRU sorted list of cache files across
|
||||
* all applications. If the currently available free storage
|
||||
* on the device is greater than or equal to the requested
|
||||
* free storage, no cache files are cleared. If the currently
|
||||
* available storage on the device is less than the requested
|
||||
* free storage, some or all of the cache files across
|
||||
* all applications are deleted (based on last accessed time)
|
||||
* to increase the free storage space on the device to
|
||||
* the requested value. There is no guarantee that clearing all
|
||||
* the cache files from all applications will clear up
|
||||
* enough storage to achieve the desired value.
|
||||
* @param freeStorageSize The number of bytes of storage to be
|
||||
* freed by the system. Say if freeStorageSize is XX,
|
||||
* and the current free storage is YY,
|
||||
* if XX is less than YY, just return. if not free XX-YY number
|
||||
* of bytes if possible.
|
||||
* @param opFinishedIntent PendingIntent call back used to
|
||||
* notify when the operation is completed.May be null
|
||||
* to indicate that no call back is desired.
|
||||
*
|
||||
* @deprecated
|
||||
* @hide
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract void freeStorage(long freeStorageSize, PendingIntent opFinishedIntent);
|
||||
|
||||
/**
|
||||
* Free storage by deleting LRU sorted list of cache files across
|
||||
* all applications. If the currently available free storage
|
||||
@@ -1551,7 +1522,7 @@ public abstract class PackageManager {
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public abstract void freeStorageWithIntent(long freeStorageSize, IntentSender pi);
|
||||
public abstract void freeStorage(long freeStorageSize, IntentSender pi);
|
||||
|
||||
/**
|
||||
* Retrieve the size information for a package.
|
||||
|
||||
@@ -26,8 +26,6 @@ import org.xmlpull.v1.XmlSerializer;
|
||||
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.IActivityManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.PendingIntent.CanceledException;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -936,33 +934,7 @@ class PackageManagerService extends IPackageManager.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
public void freeStorage(final long freeStorageSize, final PendingIntent opFinishedIntent) {
|
||||
mContext.enforceCallingOrSelfPermission(
|
||||
android.Manifest.permission.CLEAR_APP_CACHE, null);
|
||||
// Queue up an async operation since clearing cache may take a little while.
|
||||
mHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
mHandler.removeCallbacks(this);
|
||||
int retCode = -1;
|
||||
if (mInstaller != null) {
|
||||
retCode = mInstaller.freeCache(freeStorageSize);
|
||||
if (retCode < 0) {
|
||||
Log.w(TAG, "Couldn't clear application caches");
|
||||
}
|
||||
}
|
||||
if(opFinishedIntent != null) {
|
||||
try {
|
||||
// Callback via pending intent
|
||||
opFinishedIntent.send((retCode >= 0) ? 1 : 0);
|
||||
} catch (CanceledException e1) {
|
||||
Log.i(TAG, "Failed to send pending intent");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void freeStorageWithIntent(final long freeStorageSize, final IntentSender pi) {
|
||||
public void freeStorage(final long freeStorageSize, final IntentSender pi) {
|
||||
mContext.enforceCallingOrSelfPermission(
|
||||
android.Manifest.permission.CLEAR_APP_CACHE, null);
|
||||
// Queue up an async operation since clearing cache may take a little while.
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package android.test.mock;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
@@ -327,21 +326,12 @@ public class MockPackageManager extends PackageManager {
|
||||
long idealStorageSize, IPackageDataObserver observer) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide - to match hiding in superclass
|
||||
*/
|
||||
@Override
|
||||
public void freeStorage(
|
||||
long idealStorageSize, PendingIntent onFinishedIntent) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide - to match hiding in superclass
|
||||
*/
|
||||
@Override
|
||||
public void freeStorageWithIntent(
|
||||
public void freeStorage(
|
||||
long idealStorageSize, IntentSender pi) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@@ -507,7 +507,7 @@ public class AppCacheTest extends AndroidTestCase {
|
||||
try {
|
||||
// Spin lock waiting for call back
|
||||
synchronized(r) {
|
||||
getPm().freeStorage(idealStorageSize, pi);
|
||||
getPm().freeStorage(idealStorageSize, pi.getIntentSender());
|
||||
long waitTime = 0;
|
||||
while(!r.isDone() && (waitTime < MAX_WAIT_TIME)) {
|
||||
r.wait(WAIT_TIME_INCR);
|
||||
|
||||
Reference in New Issue
Block a user