remove usage of hidden public constants.
Vasu Nori [Wed, 20 Oct 2010 20:38:10 +0000 (13:38 -0700)]
Change-Id: I2edf1bef5e741de8193cb293807e3ace42003b0c

src/com/android/providers/downloads/Constants.java
src/com/android/providers/downloads/DownloadNotification.java
src/com/android/providers/downloads/DownloadProvider.java
src/com/android/providers/downloads/DownloadReceiver.java
src/com/android/providers/downloads/DownloadService.java
src/com/android/providers/downloads/DownloadThread.java
tests/public_api_access/src/com/android/providers/downloads/public_api_access_tests/PublicApiAccessTest.java
tests/src/com/android/providers/downloads/AbstractDownloadManagerFunctionalTest.java
tests/src/com/android/providers/downloads/DownloadManagerFunctionalTest.java

index 5cf1353..fe03bf7 100644 (file)
@@ -16,7 +16,6 @@
 
 package com.android.providers.downloads;
 
-import android.util.Config;
 import android.util.Log;
 
 /**
@@ -145,8 +144,7 @@ public class Constants {
 
     /** Enable verbose logging - use with "setprop log.tag.DownloadManager VERBOSE" */
     private static final boolean LOCAL_LOGV = false;
-    public static final boolean LOGV = Config.LOGV
-            || (Config.LOGD && LOCAL_LOGV && Log.isLoggable(TAG, Log.VERBOSE));
+    public static final boolean LOGV = LOCAL_LOGV && Log.isLoggable(TAG, Log.VERBOSE);
 
     /** Enable super-verbose logging */
     private static final boolean LOCAL_LOGVV = false;
index 4d615df..4002a97 100644 (file)
@@ -259,12 +259,12 @@ class DownloadNotification {
 
     private boolean isActiveAndVisible(DownloadInfo download) {
         return 100 <= download.mStatus && download.mStatus < 200
-                && download.mVisibility != Downloads.VISIBILITY_HIDDEN;
+                && download.mVisibility != Downloads.Impl.VISIBILITY_HIDDEN;
     }
 
     private boolean isCompleteAndVisible(DownloadInfo download) {
         return download.mStatus >= 200
-                && download.mVisibility == Downloads.VISIBILITY_VISIBLE_NOTIFY_COMPLETED;
+                && download.mVisibility == Downloads.Impl.VISIBILITY_VISIBLE_NOTIFY_COMPLETED;
     }
 
     /*
index 9998c3b..f6f1b94 100644 (file)
@@ -25,10 +25,7 @@ import android.content.UriMatcher;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.PackageManager.NameNotFoundException;
-import android.database.CrossProcessCursor;
 import android.database.Cursor;
-import android.database.CursorWindow;
-import android.database.CursorWrapper;
 import android.database.SQLException;
 import android.database.sqlite.SQLiteDatabase;
 import android.database.sqlite.SQLiteOpenHelper;
@@ -49,7 +46,6 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 
 /**
index c41895b..2cb6aba 100644 (file)
@@ -41,6 +41,7 @@ public class DownloadReceiver extends BroadcastReceiver {
     @VisibleForTesting
     SystemFacade mSystemFacade = null;
 
+    @Override
     public void onReceive(Context context, Intent intent) {
         if (mSystemFacade == null) {
             mSystemFacade = new RealSystemFacade(context);
index 169ef97..2596fae 100644 (file)
@@ -44,7 +44,6 @@ import com.google.android.collect.Maps;
 import com.google.common.annotations.VisibleForTesting;
 
 import java.io.File;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
@@ -114,6 +113,7 @@ public class DownloadService extends Service {
          * Receives notification when the data in the observed content
          * provider changes.
          */
+        @Override
         public void onChange(final boolean selfChange) {
             if (Constants.LOGVV) {
                 Log.v(Constants.TAG, "Service ContentObserver received notification");
@@ -188,6 +188,7 @@ public class DownloadService extends Service {
      *
      * @throws UnsupportedOperationException
      */
+    @Override
     public IBinder onBind(Intent i) {
         throw new UnsupportedOperationException("Cannot bind to Download Manager Service");
     }
@@ -195,6 +196,7 @@ public class DownloadService extends Service {
     /**
      * Initializes the service when it is first created
      */
+    @Override
     public void onCreate() {
         super.onCreate();
         if (Constants.LOGVV) {
@@ -232,6 +234,7 @@ public class DownloadService extends Service {
     /**
      * Cleans up when the service is destroyed
      */
+    @Override
     public void onDestroy() {
         getContentResolver().unregisterContentObserver(mObserver);
         if (Constants.LOGVV) {
@@ -258,6 +261,7 @@ public class DownloadService extends Service {
             super("Download Service");
         }
 
+        @Override
         public void run() {
             Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
 
index 95e9e96..f6f511e 100644 (file)
@@ -24,7 +24,6 @@ import android.content.Intent;
 import android.drm.mobile1.DrmRawContent;
 import android.net.http.AndroidHttpClient;
 import android.net.Proxy;
-import android.net.Uri;
 import android.os.FileUtils;
 import android.os.PowerManager;
 import android.os.Process;
index 2674e90..7633941 100644 (file)
@@ -57,7 +57,7 @@ public class PublicApiAccessTest extends AndroidTestCase {
     @Override
     protected void tearDown() throws Exception {
         if (mContentResolver != null) {
-            mContentResolver.delete(Downloads.CONTENT_URI, null, null);
+            mContentResolver.delete(Downloads.Impl.CONTENT_URI, null, null);
         }
         super.tearDown();
     }
index d04fd2d..a06597f 100644 (file)
@@ -189,8 +189,8 @@ public abstract class AbstractDownloadManagerFunctionalTest extends
         if (mResolver == null) {
             return;
         }
-        String[] columns = new String[] {Downloads._DATA};
-        Cursor cursor = mResolver.query(Downloads.CONTENT_URI, columns, null, null, null);
+        String[] columns = new String[] {Downloads.Impl._DATA};
+        Cursor cursor = mResolver.query(Downloads.Impl.CONTENT_URI, columns, null, null, null);
         try {
             for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
                 String filePath = cursor.getString(0);
@@ -201,7 +201,7 @@ public abstract class AbstractDownloadManagerFunctionalTest extends
         } finally {
             cursor.close();
         }
-        mResolver.delete(Downloads.CONTENT_URI, null, null);
+        mResolver.delete(Downloads.Impl.CONTENT_URI, null, null);
     }
 
     /**
index 0cb63e0..bc3de1d 100644 (file)
@@ -46,10 +46,10 @@ public class DownloadManagerFunctionalTest extends AbstractDownloadManagerFuncti
 
         String path = "/download_manager_test_path";
         Uri downloadUri = requestDownload(path);
-        assertEquals(Downloads.STATUS_PENDING, getDownloadStatus(downloadUri));
+        assertEquals(Downloads.Impl.STATUS_PENDING, getDownloadStatus(downloadUri));
         assertTrue(mTestContext.mHasServiceBeenStarted);
 
-        runUntilStatus(downloadUri, Downloads.STATUS_SUCCESS);
+        runUntilStatus(downloadUri, Downloads.Impl.STATUS_SUCCESS);
         RecordedRequest request = takeRequest();
         assertEquals("GET", request.getMethod());
         assertEquals(path, request.getPath());
@@ -61,9 +61,9 @@ public class DownloadManagerFunctionalTest extends AbstractDownloadManagerFuncti
     public void testDownloadToCache() throws Exception {
         enqueueResponse(HTTP_OK, FILE_CONTENT);
         Uri downloadUri = requestDownload("/path");
-        updateDownload(downloadUri, Downloads.COLUMN_DESTINATION,
-                       Integer.toString(Downloads.DESTINATION_CACHE_PARTITION));
-        runUntilStatus(downloadUri, Downloads.STATUS_SUCCESS);
+        updateDownload(downloadUri, Downloads.Impl.COLUMN_DESTINATION,
+                       Integer.toString(Downloads.Impl.DESTINATION_CACHE_PARTITION));
+        runUntilStatus(downloadUri, Downloads.Impl.STATUS_SUCCESS);
         assertEquals(FILE_CONTENT, getDownloadContents(downloadUri));
         assertStartsWith(Environment.getDownloadCacheDirectory().getPath(),
                          getDownloadFilename(downloadUri));
@@ -76,18 +76,18 @@ public class DownloadManagerFunctionalTest extends AbstractDownloadManagerFuncti
         // for a normal download, roaming is fine
         enqueueResponse(HTTP_OK, FILE_CONTENT);
         Uri downloadUri = requestDownload("/path");
-        runUntilStatus(downloadUri, Downloads.STATUS_SUCCESS);
+        runUntilStatus(downloadUri, Downloads.Impl.STATUS_SUCCESS);
 
         // when roaming is disallowed, the download should pause...
         downloadUri = requestDownload("/path");
-        updateDownload(downloadUri, Downloads.COLUMN_DESTINATION,
-                       Integer.toString(Downloads.DESTINATION_CACHE_PARTITION_NOROAMING));
+        updateDownload(downloadUri, Downloads.Impl.COLUMN_DESTINATION,
+                       Integer.toString(Downloads.Impl.DESTINATION_CACHE_PARTITION_NOROAMING));
         runUntilStatus(downloadUri, Downloads.Impl.STATUS_WAITING_FOR_NETWORK);
 
         // ...and pick up when we're off roaming
         enqueueResponse(HTTP_OK, FILE_CONTENT);
         mSystemFacade.mIsRoaming = false;
-        runUntilStatus(downloadUri, Downloads.STATUS_SUCCESS);
+        runUntilStatus(downloadUri, Downloads.Impl.STATUS_SUCCESS);
     }
 
     /**
@@ -108,11 +108,11 @@ public class DownloadManagerFunctionalTest extends AbstractDownloadManagerFuncti
     }
 
     protected int getDownloadStatus(Uri downloadUri) {
-        return Integer.valueOf(getDownloadField(downloadUri, Downloads.COLUMN_STATUS));
+        return Integer.valueOf(getDownloadField(downloadUri, Downloads.Impl.COLUMN_STATUS));
     }
 
     private String getDownloadFilename(Uri downloadUri) {
-        return getDownloadField(downloadUri, Downloads._DATA);
+        return getDownloadField(downloadUri, Downloads.Impl._DATA);
     }
 
     private String getDownloadField(Uri downloadUri, String column) {
@@ -132,9 +132,9 @@ public class DownloadManagerFunctionalTest extends AbstractDownloadManagerFuncti
      */
     private Uri requestDownload(String path) throws MalformedURLException {
         ContentValues values = new ContentValues();
-        values.put(Downloads.COLUMN_URI, getServerUri(path));
-        values.put(Downloads.COLUMN_DESTINATION, Downloads.DESTINATION_EXTERNAL);
-        return mResolver.insert(Downloads.CONTENT_URI, values);
+        values.put(Downloads.Impl.COLUMN_URI, getServerUri(path));
+        values.put(Downloads.Impl.COLUMN_DESTINATION, Downloads.Impl.DESTINATION_EXTERNAL);
+        return mResolver.insert(Downloads.Impl.CONTENT_URI, values);
     }
 
     /**