1 /* |
1 /* |
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
21 import com.nokia.mj.impl.installer.exetable.ExeBall; |
21 import com.nokia.mj.impl.installer.exetable.ExeBall; |
22 import com.nokia.mj.impl.installer.exetable.ExeStep; |
22 import com.nokia.mj.impl.installer.exetable.ExeStep; |
23 import com.nokia.mj.impl.installer.storagehandler.ApplicationInfo; |
23 import com.nokia.mj.impl.installer.storagehandler.ApplicationInfo; |
24 import com.nokia.mj.impl.installer.storagehandler.SuiteInfo; |
24 import com.nokia.mj.impl.installer.storagehandler.SuiteInfo; |
25 import com.nokia.mj.impl.installer.utils.Log; |
25 import com.nokia.mj.impl.installer.utils.Log; |
|
26 import com.nokia.mj.impl.installer.utils.AutoStartPermission; |
26 import com.nokia.mj.impl.utils.InstallerDetailedErrorMessage; |
27 import com.nokia.mj.impl.utils.InstallerDetailedErrorMessage; |
27 import com.nokia.mj.impl.utils.InstallerErrorMessage; |
28 import com.nokia.mj.impl.utils.InstallerErrorMessage; |
28 import com.nokia.mj.impl.utils.OtaStatusCode; |
29 import com.nokia.mj.impl.utils.OtaStatusCode; |
29 import com.nokia.mj.impl.utils.exception.InvalidAttributeException; |
30 import com.nokia.mj.impl.utils.exception.InvalidAttributeException; |
|
31 import com.nokia.mj.impl.security.midp.authorization.AccessControllerFactoryImpl; |
|
32 import com.nokia.mj.impl.security.midp.authorization.AccessControllerImpl; |
30 |
33 |
31 import java.util.Vector; |
34 import java.util.Vector; |
32 |
35 |
33 public class HandleCustomAttributes extends ExeStep |
36 public class HandleCustomAttributes extends ExeStep |
34 { |
37 { |
96 } |
99 } |
97 for (int i = 1; true; i++) |
100 for (int i = 1; true; i++) |
98 { |
101 { |
99 String attrName = "Nokia-MIDlet-Auto-Start-" + i; |
102 String attrName = "Nokia-MIDlet-Auto-Start-" + i; |
100 String attrValue = aBall.getAttributeValue(attrName); |
103 String attrValue = aBall.getAttributeValue(attrName); |
|
104 |
|
105 if (attrValue == null) |
|
106 { |
|
107 // Allow also this form of the name to be compatible with |
|
108 // an existing implementation |
|
109 attrName = "Nokia-MIDlet-auto-start-" + i; |
|
110 attrValue = aBall.getAttributeValue(attrName); |
|
111 |
|
112 if ((attrValue == null) && (i == 1)) |
|
113 { |
|
114 // Allow even this S40 format |
|
115 attrName = "Nokia-MIDlet-auto-start"; |
|
116 attrValue = aBall.getAttributeValue(attrName); |
|
117 } |
|
118 } |
|
119 |
101 if (attrValue != null) |
120 if (attrValue != null) |
102 { |
121 { |
103 if (apps.size() < i) |
122 if (apps.size() < i) |
104 { |
123 { |
105 break; |
124 break; |
106 } |
125 } |
107 if (attrValue.equalsIgnoreCase("false")) |
126 |
|
127 // Check if MIDlet has permission for Auto-start |
|
128 AccessControllerImpl accessControllerImpl = |
|
129 AccessControllerFactoryImpl. |
|
130 getAccessController(aBall.iStorageHandler.getSession(), |
|
131 aBall.iSuite.getUid(), |
|
132 aBall.iSuite.getName()); |
|
133 AutoStartPermission autoStartPermission = new AutoStartPermission(); |
|
134 if (!accessControllerImpl.isPermissionAllowed( |
|
135 autoStartPermission.toString())) |
|
136 { |
|
137 Log.logWarning("Attribute " + attrName + |
|
138 " ignored due to insufficient permissions"); |
|
139 break; |
|
140 } |
|
141 |
|
142 if (attrValue.equalsIgnoreCase("false") || |
|
143 attrValue.equalsIgnoreCase("no")) |
108 { |
144 { |
109 ((ApplicationInfo)apps.elementAt(i-1)). |
145 ((ApplicationInfo)apps.elementAt(i-1)). |
110 setAutoStart(ApplicationInfo.AUTOSTART_FALSE); |
146 setAutoStart(ApplicationInfo.AUTOSTART_FALSE); |
111 } |
147 } |
112 else if (attrValue.equalsIgnoreCase("true")) |
148 else if (attrValue.equalsIgnoreCase("true") || |
|
149 attrValue.equalsIgnoreCase("yes")) |
113 { |
150 { |
114 ((ApplicationInfo)apps.elementAt(i-1)). |
151 ((ApplicationInfo)apps.elementAt(i-1)). |
115 setAutoStart(ApplicationInfo.AUTOSTART_TRUE); |
152 setAutoStart(ApplicationInfo.AUTOSTART_TRUE); |
116 } |
153 } |
117 else if (attrValue.equalsIgnoreCase("once")) |
154 else if (attrValue.equalsIgnoreCase("once")) |