Merge lp:~humpolec-team/humpolec/add-updateservice into lp:humpolec
- add-updateservice
- Merge into UbuntuInstaller
Proposed by
Michał Karnicki
Status: | Work in progress |
---|---|
Proposed branch: | lp:~humpolec-team/humpolec/add-updateservice |
Merge into: | lp:humpolec |
Diff against target: |
490 lines (+277/-28) 14 files modified
AndroidManifest.xml (+29/-16) project.properties (+1/-1) res/layout/activity_update.xml (+7/-0) res/layout/fragment_update.xml (+13/-0) res/menu/update.xml (+11/-0) res/values-w820dp/dimens.xml (+10/-0) res/values/ids.xml (+23/-0) res/values/strings.xml (+5/-4) src/com/canonical/dualboot/service/UpdateService.java (+109/-0) src/com/canonical/ubuntu/installer/NumberPickerDialog.java (+0/-5) src/com/canonical/ubuntu/installer/TextPickerDialog.java (+0/-1) src/com/canonical/ubuntu/installer/UbuntuInstallService.java (+5/-0) src/com/canonical/ubuntu/installer/UpdateActivity.java (+64/-0) src/com/canonical/ubuntu/installer/Utils.java (+0/-1) |
To merge this branch: | bzr merge lp:~humpolec-team/humpolec/add-updateservice |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
The Humpolec team | Pending | ||
Review via email: mp+211965@code.launchpad.net |
Commit message
Add UpdateService stub.
Description of the change
Add UpdateService stub.
Minor clean-up (sorry about some noise, Eclipse being smart).
To post a comment you must log in.
Unmerged revisions
- 61. By Michał Karnicki
-
Add UpdateService stub. Minor clean-up.
- 60. By Ondrej Kubik
-
Bumping up version for release
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'AndroidManifest.xml' | |||
2 | --- AndroidManifest.xml 2014-03-05 15:35:14 +0000 | |||
3 | +++ AndroidManifest.xml 2014-03-20 15:01:59 +0000 | |||
4 | @@ -7,13 +7,14 @@ | |||
5 | 7 | <uses-sdk | 7 | <uses-sdk |
6 | 8 | android:minSdkVersion="17" | 8 | android:minSdkVersion="17" |
7 | 9 | android:targetSdkVersion="18" /> | 9 | android:targetSdkVersion="18" /> |
8 | 10 | |||
9 | 10 | <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | 11 | <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> |
13 | 11 | <uses-permission android:name="android.permission.GET_ACCOUNTS"/> | 12 | <uses-permission android:name="android.permission.GET_ACCOUNTS" /> |
14 | 12 | <uses-permission android:name="android.permission.ACCESS_SUPERUSER"/> | 13 | <uses-permission android:name="android.permission.ACCESS_SUPERUSER" /> |
15 | 13 | <uses-permission android:name="android.permission.WRITE_SETTINGS"/> | 14 | <uses-permission android:name="android.permission.WRITE_SETTINGS" /> |
16 | 14 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | 15 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
19 | 15 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> | 16 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> |
20 | 16 | <uses-permission android:name="android.permission.READ_PHONE_STATE"/> | 17 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> |
21 | 17 | <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | 18 | <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> |
22 | 18 | <uses-permission android:name="android.permission.BLUETOOTH" /> | 19 | <uses-permission android:name="android.permission.BLUETOOTH" /> |
23 | 19 | <uses-permission android:name="android.permission.INTERNET" /> | 20 | <uses-permission android:name="android.permission.INTERNET" /> |
24 | @@ -21,8 +22,8 @@ | |||
25 | 21 | <uses-permission android:name="android.permission.RECORD_AUDIO" /> | 22 | <uses-permission android:name="android.permission.RECORD_AUDIO" /> |
26 | 22 | <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> | 23 | <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> |
27 | 23 | <uses-permission android:name="android.permission.ACCESS_CACHE_FILESYSTEM" /> | 24 | <uses-permission android:name="android.permission.ACCESS_CACHE_FILESYSTEM" /> |
30 | 24 | <uses-permission android:name="android.permission.REBOOT"/> | 25 | <uses-permission android:name="android.permission.REBOOT" /> |
31 | 25 | <uses-permission android:name="android.permission.ACCESS_SUPERUSER"/> | 26 | <uses-permission android:name="android.permission.ACCESS_SUPERUSER" /> |
32 | 26 | 27 | ||
33 | 27 | <application | 28 | <application |
34 | 28 | android:allowBackup="true" | 29 | android:allowBackup="true" |
35 | @@ -31,9 +32,9 @@ | |||
36 | 31 | android:screenOrientation="portrait" | 32 | android:screenOrientation="portrait" |
37 | 32 | android:theme="@android:style/Theme.Holo" > | 33 | android:theme="@android:style/Theme.Holo" > |
38 | 33 | <activity | 34 | <activity |
42 | 34 | android:name=".InstallActivity" | 35 | android:name="com.canonical.ubuntu.installer.InstallActivity" |
43 | 35 | android:screenOrientation="portrait" | 36 | android:label="@string/app_name" |
44 | 36 | android:label="@string/app_name" > | 37 | android:screenOrientation="portrait" > |
45 | 37 | <intent-filter> | 38 | <intent-filter> |
46 | 38 | <action android:name="android.intent.action.MAIN" /> | 39 | <action android:name="android.intent.action.MAIN" /> |
47 | 39 | 40 | ||
48 | @@ -41,12 +42,23 @@ | |||
49 | 41 | </intent-filter> | 42 | </intent-filter> |
50 | 42 | </activity> | 43 | </activity> |
51 | 43 | <activity | 44 | <activity |
58 | 44 | android:name=".LaunchActivity" | 45 | android:name="com.canonical.ubuntu.installer.LaunchActivity" |
59 | 45 | android:screenOrientation="portrait" | 46 | android:label="@string/app_name" |
60 | 46 | android:label="@string/app_name"> | 47 | android:screenOrientation="portrait" > |
61 | 47 | </activity> | 48 | </activity> |
62 | 48 | 49 | ||
63 | 49 | <service android:name="com.canonical.ubuntu.installer.UbuntuInstallService"> | 50 | <activity |
64 | 51 | android:name="com.canonical.ubuntu.installer.UpdateActivity" | ||
65 | 52 | android:label="@string/title_activity_update" > | ||
66 | 53 | </activity> | ||
67 | 54 | |||
68 | 55 | <service android:name="com.canonical.ubuntu.installer.UbuntuInstallService" > | ||
69 | 56 | <intent-filter> | ||
70 | 57 | <action android:name="com.canonical.dualboot.ACTION_CHECK_UPDATE" /> | ||
71 | 58 | </intent-filter> | ||
72 | 59 | </service> | ||
73 | 60 | |||
74 | 61 | <service android:name="com.canonical.ubuntu.installer.UbuntuInstallService" > | ||
75 | 50 | <intent-filter> | 62 | <intent-filter> |
76 | 51 | <action android:name="com.canonical.ubuntuinstaller.UbuntuInstallService.GET_CHANNEL_LIST" /> | 63 | <action android:name="com.canonical.ubuntuinstaller.UbuntuInstallService.GET_CHANNEL_LIST" /> |
77 | 52 | <action android:name="com.canonical.ubuntuinstaller.UbuntuInstallService.DOWNLOAD_RELEASE" /> | 64 | <action android:name="com.canonical.ubuntuinstaller.UbuntuInstallService.DOWNLOAD_RELEASE" /> |
78 | @@ -65,6 +77,7 @@ | |||
79 | 65 | <action android:name="com.canonical.ubuntuinstaller.UbuntuInstallService.IS_UBUNTU_UPGRADABLE" /> | 77 | <action android:name="com.canonical.ubuntuinstaller.UbuntuInstallService.IS_UBUNTU_UPGRADABLE" /> |
80 | 66 | </intent-filter> | 78 | </intent-filter> |
81 | 67 | </service> | 79 | </service> |
82 | 80 | |||
83 | 68 | </application> | 81 | </application> |
84 | 69 | 82 | ||
85 | 70 | </manifest> | 83 | </manifest> |
86 | 71 | 84 | ||
87 | === modified file 'project.properties' | |||
88 | --- project.properties 2013-12-12 02:02:35 +0000 | |||
89 | +++ project.properties 2014-03-20 15:01:59 +0000 | |||
90 | @@ -11,4 +11,4 @@ | |||
91 | 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt | 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt |
92 | 12 | 12 | ||
93 | 13 | # Project target. | 13 | # Project target. |
95 | 14 | target=Google Inc.:Google APIs:19 | 14 | target=android-19 |
96 | 15 | 15 | ||
97 | === added directory 'res/drawable-ldpi' | |||
98 | === added file 'res/drawable-xhdpi/ic_stat_notify_ubuntu.png' | |||
99 | 16 | Binary files res/drawable-xhdpi/ic_stat_notify_ubuntu.png 1970-01-01 00:00:00 +0000 and res/drawable-xhdpi/ic_stat_notify_ubuntu.png 2014-03-20 15:01:59 +0000 differ | 16 | Binary files res/drawable-xhdpi/ic_stat_notify_ubuntu.png 1970-01-01 00:00:00 +0000 and res/drawable-xhdpi/ic_stat_notify_ubuntu.png 2014-03-20 15:01:59 +0000 differ |
100 | === added file 'res/layout/activity_update.xml' | |||
101 | --- res/layout/activity_update.xml 1970-01-01 00:00:00 +0000 | |||
102 | +++ res/layout/activity_update.xml 2014-03-20 15:01:59 +0000 | |||
103 | @@ -0,0 +1,7 @@ | |||
104 | 1 | <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
105 | 2 | xmlns:tools="http://schemas.android.com/tools" | ||
106 | 3 | android:id="@+id/container" | ||
107 | 4 | android:layout_width="match_parent" | ||
108 | 5 | android:layout_height="match_parent" | ||
109 | 6 | tools:context="com.canonical.ubuntu.installer.UpdateActivity" | ||
110 | 7 | tools:ignore="MergeRootFrame" /> | ||
111 | 0 | 8 | ||
112 | === added file 'res/layout/fragment_update.xml' | |||
113 | --- res/layout/fragment_update.xml 1970-01-01 00:00:00 +0000 | |||
114 | +++ res/layout/fragment_update.xml 2014-03-20 15:01:59 +0000 | |||
115 | @@ -0,0 +1,13 @@ | |||
116 | 1 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
117 | 2 | xmlns:tools="http://schemas.android.com/tools" | ||
118 | 3 | android:layout_width="match_parent" | ||
119 | 4 | android:layout_height="match_parent" | ||
120 | 5 | android:paddingBottom="@dimen/activity_vertical_margin" | ||
121 | 6 | android:paddingLeft="@dimen/activity_horizontal_margin" | ||
122 | 7 | android:paddingRight="@dimen/activity_horizontal_margin" | ||
123 | 8 | android:paddingTop="@dimen/activity_vertical_margin" | ||
124 | 9 | tools:context="com.canonical.ubuntu.installer.UpdateActivity$PlaceholderFragment" > | ||
125 | 10 | |||
126 | 11 | <!-- TODO --> | ||
127 | 12 | |||
128 | 13 | </RelativeLayout> | ||
129 | 0 | 14 | ||
130 | === added file 'res/menu/update.xml' | |||
131 | --- res/menu/update.xml 1970-01-01 00:00:00 +0000 | |||
132 | +++ res/menu/update.xml 2014-03-20 15:01:59 +0000 | |||
133 | @@ -0,0 +1,11 @@ | |||
134 | 1 | <menu xmlns:android="http://schemas.android.com/apk/res/android" | ||
135 | 2 | xmlns:tools="http://schemas.android.com/tools" | ||
136 | 3 | tools:context="com.canonical.ubuntu.installer.UpdateActivity" > | ||
137 | 4 | |||
138 | 5 | <item | ||
139 | 6 | android:id="@+id/action_settings" | ||
140 | 7 | android:orderInCategory="100" | ||
141 | 8 | android:showAsAction="never" | ||
142 | 9 | android:title="@string/action_settings"/> | ||
143 | 10 | |||
144 | 11 | </menu> | ||
145 | 0 | 12 | ||
146 | === added directory 'res/values-w820dp' | |||
147 | === added file 'res/values-w820dp/dimens.xml' | |||
148 | --- res/values-w820dp/dimens.xml 1970-01-01 00:00:00 +0000 | |||
149 | +++ res/values-w820dp/dimens.xml 2014-03-20 15:01:59 +0000 | |||
150 | @@ -0,0 +1,10 @@ | |||
151 | 1 | <resources> | ||
152 | 2 | |||
153 | 3 | <!-- | ||
154 | 4 | Example customization of dimensions originally defined in res/values/dimens.xml | ||
155 | 5 | (such as screen margins) for screens with more than 820dp of available width. This | ||
156 | 6 | would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). | ||
157 | 7 | --> | ||
158 | 8 | <dimen name="activity_horizontal_margin">64dp</dimen> | ||
159 | 9 | |||
160 | 10 | </resources> | ||
161 | 0 | 11 | ||
162 | === added file 'res/values/ids.xml' | |||
163 | --- res/values/ids.xml 1970-01-01 00:00:00 +0000 | |||
164 | +++ res/values/ids.xml 2014-03-20 15:01:59 +0000 | |||
165 | @@ -0,0 +1,23 @@ | |||
166 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
167 | 2 | <!-- | ||
168 | 3 | /* | ||
169 | 4 | * This file is part of Humpolec - Ubuntu dual boot for Android. | ||
170 | 5 | * Copyright 2014 Canonical Ltd. | ||
171 | 6 | * | ||
172 | 7 | * Ubuntu for Android is free software: you can redistribute it and/or modify | ||
173 | 8 | * it under the terms of the GNU General Public License as published by | ||
174 | 9 | * the Free Software Foundation. | ||
175 | 10 | * | ||
176 | 11 | * Ubuntu for Android is distributed in the hope that it will be useful, | ||
177 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
178 | 13 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. | ||
179 | 14 | * See the GNU General Public License for more details. | ||
180 | 15 | * | ||
181 | 16 | * You should have received a copy of the GNU General Public License | ||
182 | 17 | * along with Ubuntu for Android. If not, see <http://www.gnu.org/licenses/>. | ||
183 | 18 | */ | ||
184 | 19 | --> | ||
185 | 20 | |||
186 | 21 | <resources> | ||
187 | 22 | <item type="id" name="ubuntu_update_notification" /> | ||
188 | 23 | </resources> | ||
189 | 0 | \ No newline at end of file | 24 | \ No newline at end of file |
190 | 1 | 25 | ||
191 | === modified file 'res/values/strings.xml' | |||
192 | --- res/values/strings.xml 2014-01-09 08:54:46 +0000 | |||
193 | +++ res/values/strings.xml 2014-03-20 15:01:59 +0000 | |||
194 | @@ -1,10 +1,11 @@ | |||
195 | 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
196 | 2 | <resources> | 2 | <resources> |
197 | 3 | |||
198 | 3 | <string name="yes">Yes</string> | 4 | <string name="yes">Yes</string> |
199 | 4 | <string name="no">No</string> | 5 | <string name="no">No</string> |
200 | 5 | <string name="ok">OK</string> | 6 | <string name="ok">OK</string> |
201 | 6 | 7 | ||
203 | 7 | <!-- string for InstallActivity --> | 8 | <!-- string for InstallActivity --> |
204 | 8 | <string name="app_name">Ubuntu Dual Boot</string> | 9 | <string name="app_name">Ubuntu Dual Boot</string> |
205 | 9 | <string name="action_settings">Settings</string> | 10 | <string name="action_settings">Settings</string> |
206 | 10 | <string name="action_detele_download">Delete download</string> | 11 | <string name="action_detele_download">Delete download</string> |
207 | @@ -39,10 +40,8 @@ | |||
208 | 39 | <string name="terminal_dump_succ">Dump Terminal successfully to file on sdcard</string> | 40 | <string name="terminal_dump_succ">Dump Terminal successfully to file on sdcard</string> |
209 | 40 | <string name="terminal_dump_fail">Dump Terminal failed to file on sdcard</string> | 41 | <string name="terminal_dump_fail">Dump Terminal failed to file on sdcard</string> |
210 | 41 | <string name="external_storage_unavailable">External Storage is not available</string> | 42 | <string name="external_storage_unavailable">External Storage is not available</string> |
211 | 42 | |||
212 | 43 | <string name="not_supported_title">Not supported</string> | 43 | <string name="not_supported_title">Not supported</string> |
213 | 44 | <string name="not_supported_message_fmt">It appears that your device (%s) is not on the supported list of Ubuntu for Phone dual boot installer. Visit <a href="https://wiki.ubuntu.com/Touch/DualBootInstallation">https://wiki.ubuntu.com/Touch/DualBootInstallation</a> to see phones that is supported.</string> | 44 | <string name="not_supported_message_fmt">It appears that your device (%s) is not on the supported list of Ubuntu for Phone dual boot installer. Visit <a href="https://wiki.ubuntu.com/Touch/DualBootInstallation">https://wiki.ubuntu.com/Touch/DualBootInstallation</a> to see phones that is supported.</string> |
214 | 45 | |||
215 | 46 | <string name="no_network_dialog_title">Network not available</string> | 45 | <string name="no_network_dialog_title">Network not available</string> |
216 | 47 | <string name="enable_network">Enable WiFi</string> | 46 | <string name="enable_network">Enable WiFi</string> |
217 | 48 | 47 | ||
218 | @@ -56,5 +55,7 @@ | |||
219 | 56 | <string-array name="uninstall_options"> | 55 | <string-array name="uninstall_options"> |
220 | 57 | <item>Delete user data</item> | 56 | <item>Delete user data</item> |
221 | 58 | </string-array> | 57 | </string-array> |
222 | 58 | |||
223 | 59 | <string name="title_activity_update">UpdateActivity</string> | ||
224 | 60 | |||
225 | 59 | </resources> | 61 | </resources> |
226 | 60 | |||
227 | 61 | 62 | ||
228 | === added directory 'src/com/canonical/dualboot' | |||
229 | === added directory 'src/com/canonical/dualboot/service' | |||
230 | === added file 'src/com/canonical/dualboot/service/UpdateService.java' | |||
231 | --- src/com/canonical/dualboot/service/UpdateService.java 1970-01-01 00:00:00 +0000 | |||
232 | +++ src/com/canonical/dualboot/service/UpdateService.java 2014-03-20 15:01:59 +0000 | |||
233 | @@ -0,0 +1,109 @@ | |||
234 | 1 | /* | ||
235 | 2 | * This file is part of Humpolec - Ubuntu dual boot for Android. | ||
236 | 3 | * Copyright 2014 Canonical Ltd. | ||
237 | 4 | * | ||
238 | 5 | * Ubuntu for Android is free software: you can redistribute it and/or modify | ||
239 | 6 | * it under the terms of the GNU General Public License as published by | ||
240 | 7 | * the Free Software Foundation. | ||
241 | 8 | * | ||
242 | 9 | * Ubuntu for Android is distributed in the hope that it will be useful, | ||
243 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
244 | 11 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. | ||
245 | 12 | * See the GNU General Public License for more details. | ||
246 | 13 | * | ||
247 | 14 | * You should have received a copy of the GNU General Public License | ||
248 | 15 | * along with Ubuntu for Android. If not, see <http://www.gnu.org/licenses/>. | ||
249 | 16 | */ | ||
250 | 17 | |||
251 | 18 | package com.canonical.dualboot.service; | ||
252 | 19 | |||
253 | 20 | import android.app.IntentService; | ||
254 | 21 | import android.app.Notification; | ||
255 | 22 | import android.app.NotificationManager; | ||
256 | 23 | import android.app.PendingIntent; | ||
257 | 24 | import android.content.Intent; | ||
258 | 25 | |||
259 | 26 | import com.canonical.ubuntu.installer.R; | ||
260 | 27 | import com.canonical.ubuntu.installer.UpdateActivity; | ||
261 | 28 | |||
262 | 29 | public class UpdateService extends IntentService { | ||
263 | 30 | public static final String ACTION_CHECK_UPDATE = | ||
264 | 31 | "com.canonical.dualboot.ACTION_CHECK_UPDATE"; | ||
265 | 32 | |||
266 | 33 | private PendingIntent mDownloadUbuntuIntent; | ||
267 | 34 | //private PendingIntent mInstallUbuntuIntent; | ||
268 | 35 | //private PendingIntent mAndroidUpdateIntent; | ||
269 | 36 | |||
270 | 37 | private Notification mUbuntuUpdateNotification; | ||
271 | 38 | //private Notification mAndroidUpdateNotification; | ||
272 | 39 | |||
273 | 40 | public UpdateService() { | ||
274 | 41 | super(UpdateService.class.getName()); | ||
275 | 42 | |||
276 | 43 | |||
277 | 44 | Intent updateActivity = new Intent(this, UpdateActivity.class); | ||
278 | 45 | updateActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); | ||
279 | 46 | mDownloadUbuntuIntent = PendingIntent.getActivity( | ||
280 | 47 | this, 0, updateActivity, PendingIntent.FLAG_UPDATE_CURRENT); | ||
281 | 48 | } | ||
282 | 49 | |||
283 | 50 | @Override | ||
284 | 51 | protected void onHandleIntent(Intent intent) { | ||
285 | 52 | final String action = intent.getAction(); | ||
286 | 53 | // TODO This should be launched from an alarm. | ||
287 | 54 | if (ACTION_CHECK_UPDATE.equals(action)) { | ||
288 | 55 | checkForUpdate(); | ||
289 | 56 | } | ||
290 | 57 | } | ||
291 | 58 | |||
292 | 59 | private void checkForUpdate() { | ||
293 | 60 | // TODO Determine available updates based on PreferenceManager.getDefaultSharedPreferences(this); | ||
294 | 61 | boolean ubuntuUpdateAvailable = true; | ||
295 | 62 | boolean androidUpdateReady = true; | ||
296 | 63 | |||
297 | 64 | if (ubuntuUpdateAvailable) { | ||
298 | 65 | boolean isDownloaded = false; | ||
299 | 66 | if (!isDownloaded) { | ||
300 | 67 | showDownloadUbuntuUpdateNotification(); | ||
301 | 68 | } else { | ||
302 | 69 | showInstallUbuntuUpdateNotification(); | ||
303 | 70 | } | ||
304 | 71 | } | ||
305 | 72 | |||
306 | 73 | if (androidUpdateReady) { | ||
307 | 74 | showPrepareForAndroidUpdateNotification(); | ||
308 | 75 | } | ||
309 | 76 | } | ||
310 | 77 | |||
311 | 78 | private void showDownloadUbuntuUpdateNotification() { | ||
312 | 79 | // TODO Extract strings. | ||
313 | 80 | Notification notification = new Notification.Builder(this) | ||
314 | 81 | .setAutoCancel(true) | ||
315 | 82 | .setSmallIcon(R.drawable.ic_stat_notify_ubuntu) | ||
316 | 83 | .setContentTitle("Ubuntu") | ||
317 | 84 | .setContentText("Ubuntu update available") | ||
318 | 85 | .setTicker("Ubuntu update available") | ||
319 | 86 | .setContentIntent(mDownloadUbuntuIntent) | ||
320 | 87 | .build(); | ||
321 | 88 | |||
322 | 89 | NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); | ||
323 | 90 | nm.notify(R.id.ubuntu_update_notification, notification); | ||
324 | 91 | } | ||
325 | 92 | |||
326 | 93 | private void showInstallUbuntuUpdateNotification() { | ||
327 | 94 | // TODO Add show install Ubuntu update notification. | ||
328 | 95 | } | ||
329 | 96 | |||
330 | 97 | private void showPrepareForAndroidUpdateNotification() { | ||
331 | 98 | // TODO Add show prepare for Android update notification. | ||
332 | 99 | } | ||
333 | 100 | |||
334 | 101 | @SuppressWarnings("unused") | ||
335 | 102 | private synchronized void hideUbuntuNotification() { | ||
336 | 103 | if (mUbuntuUpdateNotification != null) { | ||
337 | 104 | NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); | ||
338 | 105 | nm.cancel(R.id.ubuntu_update_notification); | ||
339 | 106 | } | ||
340 | 107 | mUbuntuUpdateNotification = null; | ||
341 | 108 | } | ||
342 | 109 | } | ||
343 | 0 | \ No newline at end of file | 110 | \ No newline at end of file |
344 | 1 | 111 | ||
345 | === modified file 'src/com/canonical/ubuntu/installer/NumberPickerDialog.java' | |||
346 | --- src/com/canonical/ubuntu/installer/NumberPickerDialog.java 2013-12-13 01:06:14 +0000 | |||
347 | +++ src/com/canonical/ubuntu/installer/NumberPickerDialog.java 2014-03-20 15:01:59 +0000 | |||
348 | @@ -1,19 +1,14 @@ | |||
349 | 1 | package com.canonical.ubuntu.installer; | 1 | package com.canonical.ubuntu.installer; |
350 | 2 | 2 | ||
351 | 3 | import com.canonical.ubuntu.installer.R; | ||
352 | 4 | |||
353 | 5 | import android.app.AlertDialog; | 3 | import android.app.AlertDialog; |
354 | 6 | import android.content.Context; | 4 | import android.content.Context; |
355 | 7 | import android.content.DialogInterface; | 5 | import android.content.DialogInterface; |
356 | 8 | import android.content.SharedPreferences; | ||
357 | 9 | import android.content.DialogInterface.OnClickListener; | 6 | import android.content.DialogInterface.OnClickListener; |
358 | 10 | import android.content.res.Resources; | 7 | import android.content.res.Resources; |
359 | 11 | import android.os.Bundle; | 8 | import android.os.Bundle; |
360 | 12 | import android.view.LayoutInflater; | 9 | import android.view.LayoutInflater; |
361 | 13 | import android.view.View; | 10 | import android.view.View; |
362 | 14 | import android.widget.CheckBox; | ||
363 | 15 | import android.widget.NumberPicker; | 11 | import android.widget.NumberPicker; |
364 | 16 | import android.widget.TextView; | ||
365 | 17 | 12 | ||
366 | 18 | /** | 13 | /** |
367 | 19 | * A text picker dialog that prompts the user for to select one of the text options | 14 | * A text picker dialog that prompts the user for to select one of the text options |
368 | 20 | 15 | ||
369 | === modified file 'src/com/canonical/ubuntu/installer/TextPickerDialog.java' | |||
370 | --- src/com/canonical/ubuntu/installer/TextPickerDialog.java 2013-12-13 01:06:14 +0000 | |||
371 | +++ src/com/canonical/ubuntu/installer/TextPickerDialog.java 2014-03-20 15:01:59 +0000 | |||
372 | @@ -13,7 +13,6 @@ | |||
373 | 13 | import android.view.View; | 13 | import android.view.View; |
374 | 14 | import android.widget.CheckBox; | 14 | import android.widget.CheckBox; |
375 | 15 | import android.widget.NumberPicker; | 15 | import android.widget.NumberPicker; |
376 | 16 | import android.widget.TextView; | ||
377 | 17 | 16 | ||
378 | 18 | /** | 17 | /** |
379 | 19 | * A text picker dialog that prompts the user for to select one of the text options | 18 | * A text picker dialog that prompts the user for to select one of the text options |
380 | 20 | 19 | ||
381 | === modified file 'src/com/canonical/ubuntu/installer/UbuntuInstallService.java' | |||
382 | --- src/com/canonical/ubuntu/installer/UbuntuInstallService.java 2014-01-06 15:07:12 +0000 | |||
383 | +++ src/com/canonical/ubuntu/installer/UbuntuInstallService.java 2014-03-20 15:01:59 +0000 | |||
384 | @@ -199,6 +199,7 @@ | |||
385 | 199 | }; | 199 | }; |
386 | 200 | 200 | ||
387 | 201 | class ECancelException extends Exception { | 201 | class ECancelException extends Exception { |
388 | 202 | private static final long serialVersionUID = 747982425589853525L; | ||
389 | 202 | long mDownloadedSize; | 203 | long mDownloadedSize; |
390 | 203 | 204 | ||
391 | 204 | public ECancelException(long downloadedSize){ | 205 | public ECancelException(long downloadedSize){ |
392 | @@ -208,6 +209,8 @@ | |||
393 | 208 | }; | 209 | }; |
394 | 209 | 210 | ||
395 | 210 | class ESumNotMatchException extends Exception { | 211 | class ESumNotMatchException extends Exception { |
396 | 212 | private static final long serialVersionUID = -1356096284689475876L; | ||
397 | 213 | |||
398 | 211 | public ESumNotMatchException(){ | 214 | public ESumNotMatchException(){ |
399 | 212 | super(); | 215 | super(); |
400 | 213 | } | 216 | } |
401 | @@ -218,6 +221,8 @@ | |||
402 | 218 | }; | 221 | }; |
403 | 219 | 222 | ||
404 | 220 | class EShellExecException extends Exception { | 223 | class EShellExecException extends Exception { |
405 | 224 | private static final long serialVersionUID = -9010009907016301558L; | ||
406 | 225 | |||
407 | 221 | public EShellExecException(){ | 226 | public EShellExecException(){ |
408 | 222 | super(); | 227 | super(); |
409 | 223 | } | 228 | } |
410 | 224 | 229 | ||
411 | === added file 'src/com/canonical/ubuntu/installer/UpdateActivity.java' | |||
412 | --- src/com/canonical/ubuntu/installer/UpdateActivity.java 1970-01-01 00:00:00 +0000 | |||
413 | +++ src/com/canonical/ubuntu/installer/UpdateActivity.java 2014-03-20 15:01:59 +0000 | |||
414 | @@ -0,0 +1,64 @@ | |||
415 | 1 | package com.canonical.ubuntu.installer; | ||
416 | 2 | |||
417 | 3 | import android.app.Activity; | ||
418 | 4 | import android.app.ActionBar; | ||
419 | 5 | import android.app.Fragment; | ||
420 | 6 | import android.os.Bundle; | ||
421 | 7 | import android.view.LayoutInflater; | ||
422 | 8 | import android.view.Menu; | ||
423 | 9 | import android.view.MenuItem; | ||
424 | 10 | import android.view.View; | ||
425 | 11 | import android.view.ViewGroup; | ||
426 | 12 | import android.os.Build; | ||
427 | 13 | |||
428 | 14 | public class UpdateActivity extends Activity { | ||
429 | 15 | |||
430 | 16 | @Override | ||
431 | 17 | protected void onCreate(Bundle savedInstanceState) { | ||
432 | 18 | super.onCreate(savedInstanceState); | ||
433 | 19 | setContentView(R.layout.activity_update); | ||
434 | 20 | |||
435 | 21 | if (savedInstanceState == null) { | ||
436 | 22 | getFragmentManager().beginTransaction() | ||
437 | 23 | .add(R.id.container, new PlaceholderFragment()).commit(); | ||
438 | 24 | } | ||
439 | 25 | } | ||
440 | 26 | |||
441 | 27 | @Override | ||
442 | 28 | public boolean onCreateOptionsMenu(Menu menu) { | ||
443 | 29 | |||
444 | 30 | // Inflate the menu; this adds items to the action bar if it is present. | ||
445 | 31 | getMenuInflater().inflate(R.menu.update, menu); | ||
446 | 32 | return true; | ||
447 | 33 | } | ||
448 | 34 | |||
449 | 35 | @Override | ||
450 | 36 | public boolean onOptionsItemSelected(MenuItem item) { | ||
451 | 37 | // Handle action bar item clicks here. The action bar will | ||
452 | 38 | // automatically handle clicks on the Home/Up button, so long | ||
453 | 39 | // as you specify a parent activity in AndroidManifest.xml. | ||
454 | 40 | int id = item.getItemId(); | ||
455 | 41 | if (id == R.id.action_settings) { | ||
456 | 42 | return true; | ||
457 | 43 | } | ||
458 | 44 | return super.onOptionsItemSelected(item); | ||
459 | 45 | } | ||
460 | 46 | |||
461 | 47 | /** | ||
462 | 48 | * A placeholder fragment containing a simple view. | ||
463 | 49 | */ | ||
464 | 50 | public static class PlaceholderFragment extends Fragment { | ||
465 | 51 | |||
466 | 52 | public PlaceholderFragment() { | ||
467 | 53 | } | ||
468 | 54 | |||
469 | 55 | @Override | ||
470 | 56 | public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||
471 | 57 | Bundle savedInstanceState) { | ||
472 | 58 | View rootView = inflater.inflate(R.layout.fragment_update, | ||
473 | 59 | container, false); | ||
474 | 60 | return rootView; | ||
475 | 61 | } | ||
476 | 62 | } | ||
477 | 63 | |||
478 | 64 | } | ||
479 | 0 | 65 | ||
480 | === modified file 'src/com/canonical/ubuntu/installer/Utils.java' | |||
481 | --- src/com/canonical/ubuntu/installer/Utils.java 2014-01-09 08:54:46 +0000 | |||
482 | +++ src/com/canonical/ubuntu/installer/Utils.java 2014-03-20 15:01:59 +0000 | |||
483 | @@ -180,7 +180,6 @@ | |||
484 | 180 | return size; | 180 | return size; |
485 | 181 | } | 181 | } |
486 | 182 | 182 | ||
487 | 183 | @SuppressWarnings("deprecation") | ||
488 | 184 | public static long getFreeSpaceInBytes(String fsPath) { | 183 | public static long getFreeSpaceInBytes(String fsPath) { |
489 | 185 | StatFs stats = new StatFs(fsPath); | 184 | StatFs stats = new StatFs(fsPath); |
490 | 186 | // not using getAvailableBytes() for it's not available in android 4.2 | 185 | // not using getAvailableBytes() for it's not available in android 4.2 |