Merge lp:~ccabessa/ocsinventory-android-agent/ocsinventory into lp:ocsinventory-android-agent

Proposed by Cédric Cabessa
Status: Merged
Merged at revision: 17
Proposed branch: lp:~ccabessa/ocsinventory-android-agent/ocsinventory
Merge into: lp:ocsinventory-android-agent
Diff against target: 164 lines (+31/-21)
5 files modified
AndroidManifest.xml (+3/-2)
res/values-fr/strings_prefs.xml (+0/-5)
res/values/strings_nt.xml (+4/-0)
res/values/strings_prefs.xml (+0/-6)
src/org/ocsinventory/android/sections/OCSInputs.java (+24/-8)
To merge this branch: bzr merge lp:~ccabessa/ocsinventory-android-agent/ocsinventory
Reviewer Review Type Date Requested Status
OCS Inventory Dev Team Pending
Review via email: mp+159179@code.launchpad.net

Description of the change

Hi,

Some changes I made for myself, let me know if you find them useful.
I can update those patch if they do not pass your review process, moreover fell free to change them by yourself if you want to.

I may have other bugfix/improvement in the future, I'll be happy to share them with you.

To post a comment you must log in.
Revision history for this message
Jean-Côme ESTIENNEY (cdpointpoint) wrote :

Hi,

Thanks for your contribution.

I agree your corrections and will integrate them in the next update (quickly).

regards,

JC Estienney

Envoyé depuis Courrier Windows

De : Cédric Cabessa
Envoyé : ‎16‎ ‎avril‎ ‎2013 ‎17‎:‎27
À : <email address hidden>
Objet : [Merge] lp:~ccabessa/ocsinventory-android-agent/ocsinventory into lp:ocsinventory-android-agent

Cédric Cabessa has proposed merging lp:~ccabessa/ocsinventory-android-agent/ocsinventory into lp:ocsinventory-android-agent.

Requested reviews:
  OCS Inventory Dev Team (ocsinventory-dev)

For more details, see:
https://code.launchpad.net/~ccabessa/ocsinventory-android-agent/ocsinventory/+merge/159179

Hi,

Some changes I made for myself, let me know if you find them useful.
I can update those patch if they do not pass your review process, moreover fell free to change them by yourself if you want to.

I may have other bugfix/improvement in the future, I'll be happy to share them with you.

--
https://code.launchpad.net/~ccabessa/ocsinventory-android-agent/ocsinventory/+merge/159179
Your team OCS Inventory Dev Team is requested to review the proposed merge of lp:~ccabessa/ocsinventory-android-agent/ocsinventory into lp:ocsinventory-android-agent.

17. By cdpointpoint

2.1.0.1 commit Cédric Cabessa contribution

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 2013-04-08 19:17:12 +0000
3+++ AndroidManifest.xml 2013-04-16 15:26:46 +0000
4@@ -17,6 +17,7 @@
5 <uses-permission android:name="android.permission.CAMERA" />
6 <uses-permission android:name="android.permission.BLUETOOTH" />
7 <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
8+ <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
9
10 <application
11 android:allowBackup="true"
12@@ -62,11 +63,11 @@
13 </service>
14
15 <receiver
16- android:name="OCSEventReceiver"
17+ android:name=".OCSEventReceiver"
18 android:process=":ocs_process" >
19 </receiver>
20 <receiver
21- android:name="OCSBootReceiver"
22+ android:name=".OCSBootReceiver"
23 android:process=":ocs_process" >
24 <intent-filter>
25 <action android:name="android.intent.action.BOOT_COMPLETED" />
26
27=== modified file 'res/values-fr/strings_prefs.xml'
28--- res/values-fr/strings_prefs.xml 2013-03-01 22:20:14 +0000
29+++ res/values-fr/strings_prefs.xml 2013-04-16 15:26:46 +0000
30@@ -14,15 +14,12 @@
31 <string name="pref_default_devicetag">Smartphone</string>
32 <string name="pref_title_automode">Mode automatique</string>
33 <string name="pref_description_automode">Inventaire automatique</string>
34- <string name="pref_default_automode">false</string>
35
36 <string name="pref_title_freqmaj">Fréquence d\'inventaire</string>
37 <string name="pref_dialog_freqmaj">Intervalle en heures</string>
38 <string name="pref_description_freqmaj">Fréquence d\'envoi de l\'inventaire</string>
39- <string name="pref_default_freqmaj">10</string>
40 <string name="pref_title_freqwake">Fréquence de réveil</string>
41 <string name="pref_description_freqwake">Intervalle de vérification</string>
42- <string name="pref_default_freqwake">10</string>
43 <string name="pref_dialog_freqwake">Intervalle en minutes</string>
44
45 <string name="pref_header_server">Serveur</string>
46@@ -48,9 +45,7 @@
47
48 <string name="pref_title_cachelen">Durée de vie du cache</string>
49 <string name="pref_description_cachelen">Durée de vie du cache</string>
50- <string name="pref_default_cachelen">900000</string>
51
52- <string name="pref_list_freq_zero">0</string>
53 <string name="pref_list_freq_5mn">5 minutes</string>
54 <string name="pref_list_freq_15mn">15 minutes</string>
55 <string name="pref_list_freq_30mn">30 minutes</string>
56
57=== modified file 'res/values/strings_nt.xml'
58--- res/values/strings_nt.xml 2013-04-08 19:17:12 +0000
59+++ res/values/strings_nt.xml 2013-04-16 15:26:46 +0000
60@@ -16,4 +16,8 @@
61 <item>VIDEOS</item>
62 <item>SIM</item>
63 </string-array>
64+ <string name="pref_default_automode">false</string>
65+ <string name="pref_default_freqmaj">24</string>
66+ <string name="pref_default_freqwake">10</string>
67+ <string name="pref_default_cachelen">900000</string>
68 </resources>
69\ No newline at end of file
70
71=== modified file 'res/values/strings_prefs.xml'
72--- res/values/strings_prefs.xml 2013-03-01 22:20:14 +0000
73+++ res/values/strings_prefs.xml 2013-04-16 15:26:46 +0000
74@@ -14,15 +14,12 @@
75 <string name="pref_default_devicetag">Mobile</string>
76 <string name="pref_title_automode">Automatic</string>
77 <string name="pref_description_automode">Automatic inventory</string>
78- <string name="pref_default_automode">false</string>
79
80 <string name="pref_title_freqmaj">Inventory frequency</string>
81 <string name="pref_dialog_freqmaj">Delay in hours</string>
82 <string name="pref_description_freqmaj">Delay between two inventory sent</string>
83- <string name="pref_default_freqmaj">24</string>
84 <string name="pref_title_freqwake">Wake frequency</string>
85 <string name="pref_description_freqwake">Interval between verifications</string>
86- <string name="pref_default_freqwake">10</string>
87 <string name="pref_dialog_freqwake">Delay in minutes</string>
88
89 <string name="pref_header_server">Server</string>
90@@ -48,9 +45,6 @@
91
92 <string name="pref_title_cachelen">Cache lifetime</string>
93 <string name="pref_description_cachelen">Cache live time</string>
94- <string name="pref_default_cachelen">900000</string>
95-
96- <string name="pref_list_freq_zero">0</string>
97 <string name="pref_list_freq_5mn">5 minutes</string>
98 <string name="pref_list_freq_15mn">15 minutes</string>
99 <string name="pref_list_freq_30mn">30 minutes</string>
100
101=== modified file 'src/org/ocsinventory/android/sections/OCSInputs.java'
102--- src/org/ocsinventory/android/sections/OCSInputs.java 2013-03-19 20:49:53 +0000
103+++ src/org/ocsinventory/android/sections/OCSInputs.java 2013-04-16 15:26:46 +0000
104@@ -72,16 +72,16 @@
105 OCSInput ocsci = new OCSInput ();
106 ocsci.setType("Camera");
107 ocsci.setCaption("facing unknown");
108- String sSz = getCameraMaxImgSize();
109+ String sSz = getCameraMaxImgSize(openCamera());
110 ocsci.setDescription("Image size "+sSz);
111 inputs.add(ocsci);
112 } else {
113 int numberOfCameras = Camera.getNumberOfCameras();
114 CameraInfo cameraInfo = new CameraInfo();
115- String sSz = getCameraMaxImgSize();
116
117 for (int i = 0; i < numberOfCameras; i++) {
118 OCSInput ocsci = new OCSInput ();
119+ String sSz = getCameraMaxImgSize(openCamera(i));
120 ocsci.setType("Camera");
121 Camera.getCameraInfo(i, cameraInfo);
122 if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK)
123@@ -93,13 +93,29 @@
124 }
125 }
126 }
127- private String getCameraMaxImgSize() {
128-
129- Camera cam;
130+
131+ // Build.VERSION.SDK_INT < Build.VERSION_CODES.GINGERBREAD
132+ private Camera openCamera() {
133 try {
134- cam = Camera.open();
135+ return Camera.open();
136 } catch ( RuntimeException e ) {
137- return "busy";
138+ return null;
139+ }
140+ }
141+
142+ // Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD
143+ @TargetApi(Build.VERSION_CODES.GINGERBREAD)
144+ private Camera openCamera(int idx) {
145+ try {
146+ return Camera.open(idx);
147+ } catch( RuntimeException e) {
148+ return null;
149+ }
150+ }
151+
152+ private String getCameraMaxImgSize(Camera cam) {
153+ if ( cam == null ) {
154+ return "busy";
155 }
156 Camera.Parameters params = cam.getParameters();
157 long max_v=0;
158@@ -141,4 +157,4 @@
159 return sectionTag;
160 }
161
162-}
163\ No newline at end of file
164+}

Subscribers

People subscribed via source and target branches