Exemplo n.º 1
0
 private void logFinalizeProblem(String tag) {
   try {
     FinskyLog.w("Failure %s while finalizing %s", tag, toString());
     FinskyLog.w(" file=%s, size=%d", this.mFileName, Long.valueOf(this.mSize));
     File destinationDir = ObbFactory.getParentDirectory(this.mPackageName);
     FinskyLog.w(" Contents of %s:", destinationDir.getAbsolutePath());
     if (!destinationDir.exists()) {
       FinskyLog.w(" (Does not exist)", new Object[0]);
     } else if (destinationDir.isDirectory()) {
       File[] files = destinationDir.listFiles();
       if (files == null) {
         FinskyLog.w(" (listFiles() returned null)", new Object[0]);
         return;
       }
       for (File existingFile : files) {
         FinskyLog.w(
             "  name=%s size=%d", existingFile.getName(), Long.valueOf(existingFile.length()));
       }
     } else {
       FinskyLog.w(" (Is not a directory)", new Object[0]);
     }
   } catch (Exception e) {
     FinskyLog.wtf(e, "Unexpected exception", new Object[0]);
   }
 }
Exemplo n.º 2
0
 public final void onComplete(boolean paramBoolean)
 {
   if (!paramBoolean) {
     FinskyLog.w("Could not free required amount of space for download", new Object[0]);
   }
   new Handler(DownloadQueueImpl.this.mContext.getMainLooper()).post(new DownloadQueueImpl.StartNextDownloadRunnable(DownloadQueueImpl.this, (byte)0));
 }
Exemplo n.º 3
0
 public final void notifyProgress(Download paramDownload, DownloadProgress paramDownloadProgress)
 {
   if (paramDownloadProgress.equals(paramDownload.getProgress())) {
     return;
   }
   paramDownload.setProgress(paramDownloadProgress);
   int i;
   if ((paramDownloadProgress.statusCode == this.mPreviousProgressStatus) && (this.mPreviousContentUri != null))
   {
     boolean bool = this.mPreviousContentUri.equals(paramDownload.getContentUri());
     i = 0;
     if (bool) {}
   }
   else
   {
     i = 1;
   }
   if (i != 0)
   {
     Object[] arrayOfObject = new Object[2];
     arrayOfObject[0] = paramDownload;
     arrayOfObject[1] = paramDownloadProgress.toString();
     FinskyLog.d("%s: onProgress %s.", arrayOfObject);
     this.mPreviousContentUri = paramDownload.getContentUri();
     this.mPreviousProgressStatus = paramDownloadProgress.statusCode;
   }
   notifyListeners(2, paramDownload);
 }
Exemplo n.º 4
0
 private void startNextDownload()
 {
   if (this.mRunningMap.size() >= this.mMaxConcurrent) {
     return;
   }
   long l = 0L;
   Iterator localIterator = this.mPendingQueue.keySet().iterator();
   while (localIterator.hasNext())
   {
     String str = (String)localIterator.next();
     l = Math.max(((Download)this.mPendingQueue.get(str)).getMaximumSize(), l);
   }
   Context localContext = this.mContext;
   PackageManagerHelper.2 local2 = new PackageManagerHelper.2(new PurgeCacheCallback((byte)0));
   try
   {
     Class[] arrayOfClass = new Class[2];
     arrayOfClass[0] = Long.TYPE;
     arrayOfClass[1] = IPackageDataObserver.class;
     Method localMethod = PackageManager.class.getMethod("freeStorageAndNotify", arrayOfClass);
     PackageManager localPackageManager = localContext.getPackageManager();
     Object[] arrayOfObject = new Object[2];
     arrayOfObject[0] = Long.valueOf(l);
     arrayOfObject[1] = local2;
     localMethod.invoke(localPackageManager, arrayOfObject);
     return;
   }
   catch (NoSuchMethodException localNoSuchMethodException)
   {
     FinskyLog.d("Cannot freeStorageAndNotify on this platform", new Object[0]);
     return;
   }
   catch (SecurityException localSecurityException)
   {
     FinskyLog.wtf(localSecurityException, "Cannot freeStorageAndNotify due to security exception", new Object[0]);
     return;
   }
   catch (IllegalAccessException localIllegalAccessException)
   {
     FinskyLog.wtf(localIllegalAccessException, "Cannot freeStorageAndNotify due to reflection access exception", new Object[0]);
     return;
   }
   catch (InvocationTargetException localInvocationTargetException)
   {
     FinskyLog.wtf(localInvocationTargetException, "Cannot freeStorageAndNotify due to reflection invocation exception", new Object[0]);
   }
 }
 boolean initParams() {
   if (this.mParams == null || this.mProvisioning == null) {
     FinskyLog.d(
         "Cannot run this BillingFlow since params or provisioning is null.", new Object[0]);
     fail(FinskyApp.get().getString(R.string.generic_purchase_prepare_error));
     return false;
   }
   setAddressAvailability();
   return true;
 }
Exemplo n.º 6
0
 public final void add(Download paramDownload)
 {
   
   if (paramDownload.getState() != 0)
   {
     Object[] arrayOfObject2 = new Object[3];
     arrayOfObject2[0] = paramDownload;
     arrayOfObject2[1] = paramDownload.getUrl();
     arrayOfObject2[2] = Integer.valueOf(paramDownload.getState());
     FinskyLog.wtf("Added download %s (url=%s) while in state %d", arrayOfObject2);
   }
   String str = paramDownload.getUrl();
   Download localDownload;
   if (this.mRunningMap.containsKey(str)) {
     localDownload = (Download)this.mRunningMap.get(str);
   }
   for (;;)
   {
     if (localDownload != null)
     {
       Object[] arrayOfObject1 = new Object[4];
       arrayOfObject1[0] = paramDownload;
       arrayOfObject1[1] = paramDownload.getUrl();
       arrayOfObject1[2] = localDownload;
       arrayOfObject1[3] = localDownload.getUrl();
       FinskyLog.wtf("Added download %s (url=%s) while existing found %s (url=%s)", arrayOfObject1);
     }
     FinskyLog.d("Download %s added to DownloadQueue", new Object[] { paramDownload });
     this.mPendingQueue.put(paramDownload.getUrl(), paramDownload);
     if (this.mDownloadProgressManager == null) {
       this.mDownloadProgressManager = new DownloadProgressManager(this);
     }
     setDownloadState(paramDownload, 1);
     startNextDownload();
     return;
     if (this.mPendingQueue.containsKey(str)) {
       localDownload = (Download)this.mPendingQueue.get(str);
     } else {
       localDownload = null;
     }
   }
 }
Exemplo n.º 7
0
 public final void addRecoveredDownload(Download paramDownload)
 {
   Utils.ensureOnMainThread();
   String str = paramDownload.getUrl();
   FinskyLog.d("Download queue recovering download %s.", new Object[] { paramDownload });
   setDownloadState(paramDownload, 2);
   this.mRunningMap.put(str, paramDownload);
   if (this.mDownloadProgressManager == null) {
     this.mDownloadProgressManager = new DownloadProgressManager(this);
   }
 }
Exemplo n.º 8
0
 public final void onError(Download paramDownload, int paramInt)
 {
   Object[] arrayOfObject = new Object[2];
   arrayOfObject[0] = paramDownload;
   arrayOfObject[1] = Integer.valueOf(paramInt);
   FinskyLog.d("%s: onError %d.", arrayOfObject);
   if ((paramInt == 403) || (paramInt == 401)) {
     FinskyApp.get().getVendingApi().mApiContext.mReauthenticate = true;
   }
   remove(paramDownload);
   removeFromDownloadManager(paramDownload);
 }
Exemplo n.º 9
0
 private void remove(Download paramDownload)
 {
   FinskyLog.d("Download %s removed from DownloadQueue", new Object[] { paramDownload });
   String str = paramDownload.getUrl();
   if (this.mPendingQueue.containsKey(str))
   {
     this.mPendingQueue.remove(str);
     return;
   }
   this.mRunningMap.remove(paramDownload.getUrl());
   startNextDownload();
 }
Exemplo n.º 10
0
 public void onClick(View paramView) {
   if (!readyForDisplay()) {
     FinskyLog.wtf("Module is not ready to handle click", new Object[0]);
     return;
   }
   this.mNavigationManager.goBrowse(
       ((Data) this.mModuleData).sectionMetadata.browseUrl,
       null,
       ((Data) this.mModuleData).dfeList.getBackendId(),
       this.mDfeToc,
       this);
 }
 public void run(Runnable finishRunnable) {
   if (shouldFetchProvisioning(this.mDcbStorage)) {
     fetchProvisioning(
         (String) BillingPreferences.ACCEPTED_CARRIER_TOS_VERSION.get(),
         finishRunnable,
         finishRunnable);
     return;
   }
   if (finishRunnable != null) {
     finishRunnable.run();
   }
   FinskyLog.d("No need to fetch provisioning from carrier.", new Object[0]);
 }
Exemplo n.º 12
0
 public void onReceive(Context context, Intent intent) {
   if (intent.getAction().equals("com.google.android.c2dm.intent.RECEIVE")) {
     setResultCode(-1);
     if (intent.getStringExtra("from").equals("google.com")) {
       String packageName = intent.getStringExtra("asset_package");
       String declinedReasonStr = intent.getStringExtra("decline_reason");
       int reason = -1;
       if (declinedReasonStr != null) {
         try {
           reason = Integer.valueOf(declinedReasonStr).intValue();
         } catch (NumberFormatException e) {
           FinskyLog.w("Non-numeric decline reason: %s", declinedReasonStr);
         }
       }
       FinskyLog.d(
           "Received PURCHASE_DECLINED tickle for %s reason=%d",
           packageName, Integer.valueOf(reason));
       FinskyApp.get()
           .getEventLogger()
           .logBackgroundEvent(200, packageName, String.valueOf(reason), 0, null, null);
     }
   }
 }
Exemplo n.º 13
0
 public void run()
 {
   Iterator localIterator = DownloadQueueImpl.this.mListeners.iterator();
   while (localIterator.hasNext())
   {
     DownloadQueueListener localDownloadQueueListener = (DownloadQueueListener)localIterator.next();
     try
     {
       updateListener(localDownloadQueueListener);
     }
     catch (Exception localException)
     {
       FinskyLog.wtf(localException, "Download listener threw an exception during " + this.mType, new Object[0]);
     }
   }
 }
 static boolean shouldFetchProvisioning(
     CarrierBillingStorage carrierBillingStorage,
     long now,
     long awakeTime,
     long lastCheck,
     long earliestCheck) {
   CarrierBillingParameters params = carrierBillingStorage.getParams();
   if (params == null || params.getGetProvisioningUrl() == null) {
     FinskyLog.d(
         "Required CarrierBillingParams missing. Shouldn't fetch provisioning.", new Object[0]);
     return false;
   }
   boolean hasBootedSinceLastCheck = now - lastCheck > awakeTime;
   if (now > earliestCheck) {
     return true;
   }
   if (CarrierBillingUtils.isProvisioned(carrierBillingStorage) || !hasBootedSinceLastCheck) {
     return false;
   }
   return true;
 }
Exemplo n.º 15
0
 CreateCarrierBillingFlow(
     BillingFlowContext billingFlowContext,
     BillingFlowListener listener,
     CarrierBillingStorage storage,
     DfeApi dfeApi) {
   super(billingFlowContext, listener, null);
   this.mState = State.INIT;
   this.mAddressAvailable = AddressAvailable.NO_ADDRESS;
   this.mAddResult = null;
   this.mAddressMode = AddressMode.FULL_ADDRESS;
   this.mContext = billingFlowContext;
   this.mStorage = storage;
   this.mDfeApi = dfeApi;
   this.mParams = this.mStorage.getParams();
   this.mProvisioning = this.mStorage.getProvisioning();
   if (((Boolean) G.enableDcbReducedBillingAddress.get()).booleanValue()) {
     List<Country> countries = BillingLocator.getBillingCountries();
     if (countries != null) {
       Country carrierBillingCountry =
           BillingUtils.findCountry(
               BillingUtils.getDefaultCountry(FinskyApp.get(), null), countries);
       if (carrierBillingCountry != null) {
         this.mAddressMode =
             carrierBillingCountry.allowsReducedBillingAddress
                 ? AddressMode.REDUCED_ADDRESS
                 : AddressMode.FULL_ADDRESS;
       }
     }
   }
   if (this.mDfeApi != null) {
     this.mAccountName = this.mDfeApi.getAccountName();
   }
   if (this.mParams == null || this.mParams.getName() == null) {
     FinskyLog.e("No carrier name available in params.", new Object[0]);
   } else {
     this.mTitle =
         FinskyApp.get()
             .getString(R.string.dcb_setup_title, new Object[] {this.mParams.getName()});
   }
 }
Exemplo n.º 16
0
 public final void setDownloadState(Download paramDownload, int paramInt)
 {
   paramDownload.setState(paramInt);
   switch (paramInt)
   {
   default: 
     Object[] arrayOfObject = new Object[1];
     arrayOfObject[0] = Integer.valueOf(paramInt);
     FinskyLog.wtf("enum %d", arrayOfObject);
   case 0: 
   case 1: 
     return;
   case 2: 
     notifyListeners(4, paramDownload);
     return;
   case 4: 
     notifyListeners(3, paramDownload);
     return;
   case 5: 
     notifyListeners(5, paramDownload);
     return;
   }
   notifyListeners(1, paramDownload);
 }
Exemplo n.º 17
0
 public final void onComplete(Download paramDownload)
 {
   FinskyLog.d("%s: onComplete", new Object[] { paramDownload });
   remove(paramDownload);
 }
Exemplo n.º 18
0
 private ArrayList<Integer> getInvalidEntries(InputValidationError[] inputErrors) {
   ArrayList<Integer> errors = new ArrayList();
   for (InputValidationError error : inputErrors) {
     int inputField = error.inputField;
     switch (inputField) {
       case com.google
           .android
           .wallet
           .instrumentmanager
           .R
           .styleable
           .WalletImFormEditText_required /*4*/:
       case com.google
           .android
           .wallet
           .instrumentmanager
           .R
           .styleable
           .WalletImFormEditText_validateWhenNotVisible /*5*/:
       case com.google
           .android
           .wallet
           .instrumentmanager
           .R
           .styleable
           .WalletFragmentStyle_maskedWalletDetailsBackground /*6*/:
       case com.google
           .android
           .wallet
           .instrumentmanager
           .R
           .styleable
           .WalletFragmentStyle_maskedWalletDetailsButtonTextAppearance /*7*/:
       case com.google
           .android
           .wallet
           .instrumentmanager
           .R
           .styleable
           .WalletFragmentStyle_maskedWalletDetailsButtonBackground /*8*/:
       case com.google
           .android
           .wallet
           .instrumentmanager
           .R
           .styleable
           .WalletFragmentStyle_maskedWalletDetailsLogoTextColor /*9*/:
       case com.google
           .android
           .wallet
           .instrumentmanager
           .R
           .styleable
           .MapAttrs_useViewLifecycle /*13*/:
         errors.add(Integer.valueOf(inputField));
         break;
       default:
         FinskyLog.d(
             "InputValidationError that can't be edited: type=%d, message=%s",
             Integer.valueOf(error.inputField), error.errorMessage);
         break;
     }
   }
   return errors;
 }
Exemplo n.º 19
0
 private void showError(String finskyLogString, String logString, String message) {
   FinskyLog.w(finskyLogString, new Object[0]);
   logError(logString);
   showErrorDialog(message);
 }
Exemplo n.º 20
0
 private void showNetworkError(VolleyError error) {
   FinskyLog.w("Error received: %s", error);
   logError(error);
   showErrorDialog(ErrorStrings.get(FinskyApp.get(), error));
 }
Exemplo n.º 21
0
 public final void notifyClicked(Download paramDownload)
 {
   FinskyLog.d("%s: onNotificationClicked", new Object[] { paramDownload });
   notifyListeners(0, paramDownload);
 }
Exemplo n.º 22
0
 public final void run()
 {
   
   if (DownloadQueueImpl.this.mRunningMap.size() >= DownloadQueueImpl.this.mMaxConcurrent) {}
   label203:
   do
   {
     return;
     LinkedList localLinkedList = new LinkedList();
     Iterator localIterator1 = DownloadQueueImpl.this.mPendingQueue.keySet().iterator();
     Download localDownload;
     for (;;)
     {
       boolean bool = localIterator1.hasNext();
       localObject = null;
       if (!bool) {
         break label203;
       }
       String str2 = (String)localIterator1.next();
       localDownload = (Download)DownloadQueueImpl.this.mPendingQueue.get(str2);
       localLinkedList.add(str2);
       if (localDownload.getState() == 1)
       {
         long l1 = localDownload.getMaximumSize();
         long l2 = Storage.dataPartitionAvailableSpace();
         long l3 = Storage.externalStorageAvailableSpace();
         if (localDownload.getRequestedDestination() != null)
         {
           if (l3 >= l1) {
             break;
           }
           localDownload.setHttpStatus(198);
           DownloadQueueImpl.this.setDownloadState(localDownload, 5);
         }
         else
         {
           if (l2 >= l1) {
             break;
           }
           localDownload.setHttpStatus(198);
           DownloadQueueImpl.this.setDownloadState(localDownload, 5);
         }
       }
     }
     Object localObject = localDownload;
     Iterator localIterator2 = localLinkedList.iterator();
     while (localIterator2.hasNext())
     {
       String str1 = (String)localIterator2.next();
       DownloadQueueImpl.this.mPendingQueue.remove(str1);
     }
     DownloadQueueImpl localDownloadQueueImpl = DownloadQueueImpl.this;
     if (localObject != null)
     {
       FinskyLog.d("Download %s starting", new Object[] { localObject });
       localDownloadQueueImpl.mRunningMap.put(localObject.getUrl(), localObject);
       DownloadManagerFacade localDownloadManagerFacade = localDownloadQueueImpl.mDownloadManager;
       DownloadQueueImpl.7 local7 = new DownloadQueueImpl.7(localDownloadQueueImpl, localObject);
       localDownloadManagerFacade.enqueue(localObject, local7);
     }
   } while ((DownloadQueueImpl.this.mRunningMap.size() != 0) || (DownloadQueueImpl.this.mDownloadProgressManager == null));
   DownloadProgressManager localDownloadProgressManager = DownloadQueueImpl.this.mDownloadProgressManager;
   Handler localHandler = localDownloadProgressManager.mHandler;
   DownloadProgressManager.2 local2 = new DownloadProgressManager.2(localDownloadProgressManager);
   localHandler.post(local2);
   DownloadQueueImpl.this.mDownloadProgressManager = null;
 }
Exemplo n.º 23
0
 public final void onCancel(Download paramDownload)
 {
   FinskyLog.d("%s: onCancel", new Object[] { paramDownload });
   remove(paramDownload);
   removeFromDownloadManager(paramDownload);
 }
Exemplo n.º 24
0
 public final void onStart(Download paramDownload)
 {
   FinskyLog.d("%s: onStart", new Object[] { paramDownload });
 }