⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jam_native_handler.c

📁 java 1.1 gemini 08_16
💻 C
📖 第 1 页 / 共 4 页
字号:
/*****************************************************************************
*  Copyright Statement:
*  --------------------
*  This software is protected by Copyright and the information contained
*  herein is confidential. The software may not be copied and the information
*  contained herein may not be used or disclosed except with the written
*  permission of MediaTek Inc. (C) 2001
*
*****************************************************************************/

/*****************************************************************************
 *
 * Filename:
 * ---------
 *   jam_native_handler.c
 *
 * Project:
 * --------
 *   Maui_Software
 *
 * Description:
 * ------------
 *   This file handles jam native layer for Java.
 *
 * Author:
 * -------
 * -------
 *
 *============================================================================
 *             HISTORY
 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *------------------------------------------------------------------------------
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 *------------------------------------------------------------------------------
 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *============================================================================
 ****************************************************************************/

/*************************************************************************
 * Include Statements
 *************************************************************************/
#include "kal_release.h"
#include "stack_common.h"
#include "stack_msgs.h"
#include "task_main_func.h"
#include "app_ltlcom.h"
#include "lcd_ip_cqueue.h"
#include "stack_types.h"
#include "task_config.h"
#include "syscomp_config.h"
#include "custom_config.h"
#include "custom_util.h"
#include "stack_init.h"
#include "stack_ltlcom.h"
#include "stack_msgs.h"
#include "kni.h"
#include "global.h"
#include "kvmLog.h"
#include "jal.h"
#include "jam_internal.h"
#include "jam_msg_handler.h"
#include "j2me_trace.h"
#include "jam_msg_util.h"
#include "jam_internal.h"
#include "machine_md.h"
#include "defaultLCDUI.h"
#include "midpMalloc.h"
#include "storage.h"
#include "app_buff_alloc.h"
#include "MMI_features.h"
#include "Conversions.h"
#include "j2me_custom_param.h"

#include "JavaAgencyDef.h"
#include "JavaAgencyProt.h"

extern void storageCleanup(jobject thisObject);
extern kal_bool saved_vm_pause;

kal_char * post_file_name = "\\post.tmp";
kal_bool is_in_critical_path = KAL_FALSE;
kal_bool notify_pause = KAL_FALSE;
kal_uint32 last_resume_request_time = 0;
/*************************************************************************
* FUNCTION
*  wait For MMI Remove confirm
*
* DESCRIPTION
*  Send MSG_ID_MMI_JAVA_MIDS_REMOVE_CONFIRM_IND massage to MMI, and wait 
*  for the MMI to confirm the remove action should be continued.
*
* PARAMETERS
*
* RETURNS
*  None
*
*************************************************************************/
KNIEXPORT KNI_RETURNTYPE_BOOLEAN
Java_com_sun_midp_main_CommandProcessor_removeBlockConfirm(void)
{
	bool_t commit = FALSE;
/*	This function is not used now. Please refer to jam_get_removal_confirm.
	SHORTARRAY array;

	KNI_StartHandles(1);
	KNI_DeclareHandle(confirm_msg);
	KNI_GetParameterAsObject(1, confirm_msg);
	array = (SHORTARRAY)(*confirm_msg);*/

	kal_trace(TRACE_FUNC, FUNC_J2ME_JAVA_CP_REMOVEBLOCKCONFIRM);

	commit = FALSE;

//	KNI_EndHandles();
	KNI_ReturnBoolean(commit);
}

/*************************************************************************
* FUNCTION
*  wait For MMI installation confirm
*
* DESCRIPTION
*  Send MSG_ID_MMI_JAVA_INSTALL_CONFIRM_IND massage containing confirm 
*  string to MMI, and wait for the MMI if the installation should be 
*  continued
*
* PARAMETERS
*
* RETURNS
*  None
*
*************************************************************************/

KNIEXPORT KNI_RETURNTYPE_BOOLEAN
Java_com_mtk_midp_midletsuite_MassageInstaller_waitForConfirm(void)
{
	bool_t commit = FALSE;
	SHORTARRAY array;
	KNI_StartHandles(1);
	KNI_DeclareHandle(confirm_msg);
	KNI_GetParameterAsObject(1, confirm_msg);
	install_update_status.install_cancelled = KAL_TRUE;
	kal_trace(TRACE_FUNC, FUNC_J2ME_JAVA_INSTALLER_WAITFORCONFIRM);
	/* TCK mode */
	if (Java_mode != JAVA_NORMAL_MODE)
	{
		commit = KAL_TRUE;
		goto local_install_confirm;
	}

	array = (SHORTARRAY)(*confirm_msg);
#ifndef __SUN_RI__

	/* clean message to prevent error */
	if (clean_event() != J2ME_NO_ERROR)
	{
		goto local_install_confirm;
	}

	if (Java_mode == JAVA_NORMAL_MODE)
	{
		if (install_update_status.is_local_install)
		{
			if (install_update_status.is_force_local_install)
				commit = TRUE;
			else if (install_update_status.local_install_return_code == -1)	/* error code has not been set, this is a valid install */
				commit = TRUE;
			else
				commit = FALSE;
			goto local_install_confirm;
		}
		if (array != NULL)
		{
			int len = array->length * 2 + 2;
			kal_wchar* buffer;
			buffer = (kal_wchar*)midpMalloc(len); //this memory will be freed after VM stopped
			if (buffer != NULL)
			{
				Kmemcpy(buffer, &array->sdata, len - 2);
				commit = jam_install_user_confirm(buffer);
				midpFree(buffer);
			}
		}
	} else
	{
		commit = TRUE;
	}
#else
	commit = TRUE;
#endif
	local_install_confirm:
	KNI_EndHandles();
	KNI_ReturnBoolean(commit);
}


/*************************************************************************
* FUNCTION
*  wait For RMS confirm
*
* DESCRIPTION
*  Send MSG_ID_MMI_JAVA_INSTALL_RESET_RMS_IND massage to MMI, and wait for
*  the response of MMI
*
* PARAMETERS
*
* RETURNS
*  None
*
*************************************************************************/
KNIEXPORT KNI_RETURNTYPE_BOOLEAN
Java_com_mtk_midp_midletsuite_MassageInstaller_waitForRMSConfirm(void)
{
	bool_t commit = FALSE;
#ifndef __SUN_RI__
	kal_trace(TRACE_FUNC, FUNC_J2ME_JAVA_INSTALLER_WAITFORRMSCONFIRM);
	/* clean message to prevent error */
	if (clean_event() != J2ME_NO_ERROR)
	{
		goto local_install_RMS;
	}
	if (Java_mode == JAVA_NORMAL_MODE)
	{
		if (install_update_status.is_local_install)
		{
			commit = TRUE;
			goto local_install_RMS;
		}
		commit = jam_install_get_rms_confirm();
	} else
	{
		commit = TRUE;
	}
#else
	commit = TRUE;
#endif
	local_install_RMS:
	KNI_ReturnBoolean(commit);
}

/* not used now */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_com_mtk_midp_midletsuite_MassageInstaller_sendProgressMassage(void)
{
	KNI_ReturnVoid();
}

/*************************************************************************
* FUNCTION
*  installation confirm
*
* DESCRIPTION
*  Send the installation result to MMI
*
* PARAMETERS
*
* RETURNS
*  None
*
*************************************************************************/
void Java_com_sun_midp_main_CommandProcessor_installationCNF(void)
{
	SHORTARRAY array;
	bool_t success;
	KNI_StartHandles(1);
	KNI_DeclareHandle(confirm_msg);
	KNI_GetParameterAsObject(1, confirm_msg);
	kal_trace(TRACE_FUNC, FUNC_J2ME_JAVA_INSTALLER_INSTALLCNF);
	success = KNI_GetParameterAsBoolean(2);
	array = (SHORTARRAY)(*confirm_msg);
	Kputs("Java_com_sun_midp_main_CommandProcessor_installationCNF");
#ifndef __SUN_RI__

	/* clean message to prevent error */
	(void)clean_event();
	if (Java_mode == JAVA_NORMAL_MODE)
	{
		/* the install or update is ok, don't have to do the storage_recovery */
		/*if(success){
			install_update_status.need_to_clean = KAL_FALSE;
		}*/
		if (install_update_status.is_local_install)
		{
			if (success == TRUE)
				install_update_status.local_install_return_code = J2ME_NO_ERROR;
			goto errHandle;
		}

		install_update_status.has_returned_res = KAL_TRUE;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -