Protect DownloadController instantiation
Enforce the use of DownloadService to create new DownloadController instaces, but give access to the existing instances to anyone.
This commit is contained in:
@@ -31,6 +31,9 @@ import android.support.v7.widget.SimpleItemAnimator;
|
||||
import android.util.Log;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.lineageos.updater.controller.DownloadController;
|
||||
import org.lineageos.updater.controller.DownloadControllerInt;
|
||||
import org.lineageos.updater.controller.DownloadService;
|
||||
import org.lineageos.updater.misc.Utils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.widget.Button;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.lineageos.updater.controller.DownloadControllerInt;
|
||||
import org.lineageos.updater.misc.Utils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
+6
-2
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.lineageos.updater;
|
||||
package org.lineageos.updater.controller;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -23,6 +23,10 @@ import android.os.SystemClock;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.util.Log;
|
||||
|
||||
import org.lineageos.updater.DownloadClient;
|
||||
import org.lineageos.updater.UpdateDownload;
|
||||
import org.lineageos.updater.UpdateStatus;
|
||||
import org.lineageos.updater.UpdatesDbHelper;
|
||||
import org.lineageos.updater.misc.Utils;
|
||||
|
||||
import java.io.File;
|
||||
@@ -55,7 +59,7 @@ public class DownloadController implements DownloadControllerInt {
|
||||
return sDownloadController;
|
||||
}
|
||||
|
||||
public static synchronized DownloadController getInstance(Context context) {
|
||||
protected static synchronized DownloadController getInstance(Context context) {
|
||||
if (sDownloadController == null) {
|
||||
sDownloadController = new DownloadController(context);
|
||||
}
|
||||
+3
-1
@@ -13,7 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.lineageos.updater;
|
||||
package org.lineageos.updater.controller;
|
||||
|
||||
import org.lineageos.updater.UpdateDownload;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
+4
-1
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.lineageos.updater;
|
||||
package org.lineageos.updater.controller;
|
||||
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
@@ -30,6 +30,9 @@ import android.text.format.DateUtils;
|
||||
import android.text.format.Formatter;
|
||||
import android.util.Log;
|
||||
|
||||
import org.lineageos.updater.R;
|
||||
import org.lineageos.updater.UpdateDownload;
|
||||
import org.lineageos.updater.UpdatesActivity;
|
||||
import org.lineageos.updater.misc.Utils;
|
||||
|
||||
import java.io.IOException;
|
||||
Reference in New Issue
Block a user