~humpolec-team/humpolec/UbuntuInstaller-lp1262028

« back to all changes in this revision

Viewing changes to src/com/canonical/ubuntu/installer/Utils.java

  • Committer: Y.C cheng
  • Date: 2013-12-18 12:04:17 UTC
  • mfrom: (19.1.2 UbuntuInstaller)
  • Revision ID: yc.cheng@canonical.com-20131218120417-mn4doo8jpq20uwge
1. Rename ServiceState to InstallerState in UbuntuInstallService.
2. Use InstallerState, mAvailableChannels.size() equals to zero or not
        and mDownloadedVersion to decide what to show on UI.
3. move some preference related function to UbuntuInstallService.
4. call requestServiceState() in onResume() of InstallActivity and
        update related code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
                                String result= convertStreamToString(instream);
75
75
                                // now you have the string representation of the HTML request
76
76
 
77
 
                                Log.i(TAG, result);
 
77
                                // Log.i(TAG, result);
78
78
 
79
79
                                instream.close();
80
80
 
184
184
        }
185
185
        return size;
186
186
    }
187
 
    
188
 
    /**
189
 
     * Check if there is downloaded release ready to install
190
 
     * @param context
191
 
     * @return true if there is downloaded release ready to install
192
 
     */
193
 
    public static boolean checkifReadyToInstall(Context context) {
194
 
        SharedPreferences pref = context.getSharedPreferences( UbuntuInstallService.SHARED_PREF, Context.MODE_PRIVATE);
195
 
        String command = pref.getString(UbuntuInstallService.PREF_KEY_UPDATE_COMMAND, "");
196
 
        boolean ready = false;
197
 
        if (!command.equals("")){
198
 
            File f = new File(command);
199
 
            if (f.exists()) {
200
 
                return true;
201
 
            } else {
202
 
                pref.edit().putString(UbuntuInstallService.PREF_KEY_UPDATE_COMMAND, "").commit();
203
 
                return false;
204
 
            }
205
 
        }
206
 
        return false;
207
 
    }
208
187
 
209
188
    @SuppressWarnings("deprecation")
210
189
    public static long getFreeSpaceInBytes(String fsPath) {
225
204
        }
226
205
        return "";
227
206
    }
228
 
    
 
207
 
229
208
    public static String getRecoveryPartitionPath() {
230
209
        String deviceModel = Build.DEVICE.toLowerCase(Locale.US);
231
210
        if ("mako".equals(deviceModel)) {