78
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
package com.nokia.mj.impl.mms;
|
|
18 |
|
|
19 |
import com.nokia.mj.impl.utils.Logger;
|
|
20 |
import com.nokia.mj.impl.rt.support.Jvm;
|
|
21 |
import com.nokia.mj.impl.push.PushUtil;
|
|
22 |
import com.nokia.mj.impl.push.PushUtil.PushRegInfo;
|
|
23 |
import com.nokia.mj.impl.installer.jsrpluginnotifier.InstallerExtension;
|
|
24 |
import com.nokia.mj.impl.installer.jsrpluginnotifier.InstallerExtensionInfo;
|
|
25 |
|
|
26 |
public final class MMSInstallerPlugin implements InstallerExtension
|
|
27 |
{
|
|
28 |
static
|
|
29 |
{
|
|
30 |
try
|
|
31 |
{
|
|
32 |
Jvm.loadSystemLibrary("javawmamms");
|
|
33 |
}
|
|
34 |
catch (Throwable Th)
|
|
35 |
{
|
|
36 |
Logger.ELOG(Logger.EWMA, "Loading WMA protocol failed", Th);
|
|
37 |
}
|
|
38 |
}
|
|
39 |
/**
|
|
40 |
* This method is called when installation has been done
|
|
41 |
* nearly completely (only committing changes is left).
|
|
42 |
* @param aInstallerExtensionInfo installation info
|
|
43 |
* @return true if installation can be finished
|
|
44 |
* false if installation must be cancelled
|
|
45 |
*/
|
|
46 |
public boolean install(InstallerExtensionInfo aInstallerExtensionInfo){
|
|
47 |
return true;
|
|
48 |
}
|
|
49 |
|
|
50 |
/**
|
|
51 |
* This method is called when uninstallation is starting
|
|
52 |
* (all information is still available in databases).
|
|
53 |
* @param aInstallerExtensionInfo uninstallation info
|
|
54 |
* @return true if uninstallation can be finished
|
|
55 |
* false if uninstallation must be cancelled
|
|
56 |
*/
|
|
57 |
public boolean uninstall(InstallerExtensionInfo aInstallerExtensionInfo){
|
|
58 |
PushRegInfo[] pushRegArray = PushUtil.getPushRegs(
|
|
59 |
aInstallerExtensionInfo.iStorageSession ,aInstallerExtensionInfo.iUid);
|
|
60 |
for(int i = 0;i < pushRegArray.length;i++)
|
|
61 |
{
|
|
62 |
String url = pushRegArray[i].getUrl();
|
|
63 |
if (url.startsWith("mms://:"))
|
|
64 |
{
|
|
65 |
int err = _unregisterFromMMSEngine(url.substring(7));
|
|
66 |
if (0 != err)
|
|
67 |
return false;
|
|
68 |
}
|
|
69 |
}
|
|
70 |
return true;
|
|
71 |
}
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Called when installation has failed and will be rolled back.
|
|
75 |
* Called after install().
|
|
76 |
*
|
|
77 |
* @param aInstallerExtensionInfo installation info
|
|
78 |
*/
|
|
79 |
public void rollbackInstall(InstallerExtensionInfo aInstallerExtensionInfo){
|
|
80 |
}
|
|
81 |
|
|
82 |
/**
|
|
83 |
* Called when uninstallation has failed and will be rolled back.
|
|
84 |
* Called after uninstall().
|
|
85 |
*
|
|
86 |
* @param aInstallerExtensionInfo installation info
|
|
87 |
*/
|
|
88 |
public void rollbackUninstall(InstallerExtensionInfo aInstallerExtensionInfo){
|
|
89 |
}
|
|
90 |
|
|
91 |
private native int _unregisterFromMMSEngine(String aUri);
|
|
92 |
|
|
93 |
} |