AppList.h 16.6 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578
/*****************************************************************************
*  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) 2005
*
*  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
*  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
*  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
*  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
*  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
*  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
*  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
*  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
*  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
*  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
*  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
*  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
*  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
*  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
*  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
*  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
*
*  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
*  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
*  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
*  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
*  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*****************************************************************************
 *
 * Filename:
 * ---------
 *  AppList.h
 *
 * Project:
 * --------
 *  MAUI
 *
 * Description:
 * ------------
 *  AppList Applications v0.1
 *
 * 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!
 *
 *------------------------------------------------------------------------------
 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *============================================================================
 ****************************************************************************/

/****************************************************************************
* Include Files                                                                
*****************************************************************************/
#ifndef _MMI_APPLIST_H_
#define _MMI_APPLIST_H_

#include "mmi_features.h"

#ifdef __MMI_LAUNCHER_APP_LIST__

#include "MMIDataType.h"
#include "gdi_datatype.h"
#include "AppMgrSrvGprot.h"
#include "IdleMemCfg.h"
#include "AppListDef.h"
#include "AppListVLW.h"
#include "AppListDraw.h"


/***************************************************************************** 
 * Define
 *****************************************************************************/
#define MMI_APPLIST_INVALID_INDEX (-1) 
#define MMI_APPLIST_CACHE_INDEX (0x7FFFFFFF) 

#define APPLIST_ABS(a)  ((a) < 0 ? -(a) : (a))

#define __RANFOW_DEBUG__
#ifdef __RANFOW_DEBUG__
#ifndef __MTK_TARGET__
#define RANFOW_TRACE(format, ...) printf((format), ##__VA_ARGS__)
#else
#define RANFOW_TRACE(...) kal_prompt_trace(MOD_IDLE, __VA_ARGS__)
#endif
#else
#define RANFOW_TRACE(format, ...)
#endif

/***************************************************************************** 
 * Enum
 *****************************************************************************/
typedef enum
{
    MMI_APPLIST_AREA_TYPE_INVALID,
    MMI_APPLIST_AREA_TYPE_SLIDE,
    MMI_APPLIST_AREA_TYPE_INDICATOR_BAR,
    MMI_APPLIST_AREA_TYPE_SHORTCUT_BAR
}mmi_applist_area_type_enum;

typedef enum
{
    MMI_APPLIST_CELL_TYPE_PANEL,
    MMI_APPLIST_CELL_TYPE_SHORTCUT
}mmi_applist_cell_type_enum;

typedef enum
{
    MMI_APPLIST_CELL_STATE_UNSELECTED,
    MMI_APPLIST_CELL_STATE_TOUCHED,
    MMI_APPLIST_CELL_STATE_SELECTED
}mmi_applist_cell_state_enum;

typedef enum
{
    MMI_APPLIST_INDICATOR_STATE_DISABLE,
    MMI_APPLIST_INDICATOR_STATE_INACTIVE,
    MMI_APPLIST_INDICATOR_STATE_ACTIVE
}mmi_applist_indicator_state_enum;

typedef enum
{
    MMI_APPLIST_SLIDE_STATE_DISABLE,
    MMI_APPLIST_SLIDE_STATE_ENABLE,    
    MMI_APPLIST_SLIDE_STATE_ENABLE_EXPENDED,
    MMI_APPLIST_SLIDE_STATE_DISABLE_EXPENDED
}mmi_applist_slide_state_enum;

typedef enum
{
    MMI_APPLIST_MODE_NORMAL,
    MMI_APPLIST_MODE_EDIT,
#ifdef __MMI_APPLIST_BARREL_SUPPORT__
    MMI_APPLIST_MODE_EFFECT_PREVIEW,
#endif
    MMI_APPLIST_MODE_POPUP
}mmi_applist_mode_enum;

typedef enum
{
    MMI_APPLIST_MATRIX_TYPE_MOVE,
    MMI_APPLIST_MATRIX_TYPE_SCALE,
    MMI_APPLIST_MATRIX_TYPE_ROTATE
}mmi_applist_matrix_type_enum;

/* Assume cache three page */
typedef enum
{
    MMI_APPLIST_CACHE_TYPE_THIS,
    MMI_APPLIST_CACHE_TYPE_NEARBY,
    MMI_APPLIST_CACHE_TYPE_PREVIOUS,
    MMI_APPLIST_CACHE_TYPE_NEXT
}mmi_applist_cache_type_enum;

typedef enum
{
    MMI_APPLIST_WP_STATE_CLOSED,
    MMI_APPLIST_WP_STATE_OPENED,
    MMI_APPLIST_WP_STATE_PLAYING,    
}mmi_applist_wallpaper_state_enum;

typedef enum
{    
    MMI_APPLIST_WP_STOP_TYPE_NONE,
    MMI_APPLIST_WP_STOP_TYPE_EDIT_MODE  = (1<<0),
    MMI_APPLIST_WP_STOP_TYPE_PEN_DOWN   = (1<<1),
    MMI_APPLIST_WP_STOP_TYPE_SLIDE_BY_KEY = (1<<2) 
}mmi_applist_wp_stop_type_enum;

typedef enum
{
    MMI_APPLIST_SLIDE_BY_PEN,
    MMI_APPLIST_SLIDE_BY_KEY
} mmi_applist_slide_type_enum;

typedef enum
{
    MMI_APPLIST_STATE_NONE,         //launcher is not active
    MMI_APPLIST_STATE_FIRST_ENTER,  //first enter launcher
    MMI_APPLIST_STATE_ENTER,        //enter launcher
    MMI_APPLIST_STATE_NORMAL,       //launcher is normal running
    MMI_APPLIST_STATE_RESET,        //exit from edit mode
    MMI_APPLIST_STATE_AUTOSLIDE,    //launcher auto slide by pen moving in edit mode
    MMI_APPLIST_STATE_CYCLIC,       //launcher cyclic by key
    MMI_APPLIST_STATE_SLIDING,      //sliding
} mmi_applist_state_enum;

/***************************************************************************** 
 * Structure
 *****************************************************************************/

typedef struct
{
    MMI_EVT_PARAM_HEADER
    U32 app_id;
} mmi_applist_launch_event_struct;

typedef struct
{
    U8 buffer[MMI_APPLIST_APP_CACHE_SIZE];
}mmi_applist_cache_struct;

typedef struct
{
    mmi_applist_area_type_enum type;
    S32 index;
} mmi_applist_hit_area_struct;

typedef struct
{
    mmi_applist_cell_state_enum state;
    mmi_applist_cell_type_enum type;
    S32 index;    
    mmi_applist_position pen_shift;
    
    mmi_applist_cell_struct *cell_p;
} mmi_applist_focus_cell_struct;

#ifdef __MMI_APPLIST_KEY_SUPPORT__
typedef struct
{
    gdi_handle hilight_handle;
    mmi_applist_cell_type_enum type;
    S32 index; 
    mmi_applist_cell_type_enum pre_type;
    S32 pre_index;

    mmi_applist_cell_struct *cell_p;
    #ifndef __MMI_APPLIST_ONLY_ICON_SUPPORT__
    U32 scroll_x;
    #endif
}mmi_applist_hilight_frame_info_struct;

#endif /* __MMI_APPLIST_KEY_SUPPORT__ */

/* when moving cell in edit mode, if the page we move to is full, the last cell will be cached */
typedef struct
{    
    mmi_applist_cell_struct *cell_p;
    S32 page_idx;
}mmi_applist_cache_cell_struct;

typedef struct
{    
    mmi_applist_indicator_state_enum state;
    mmi_applist_position pos;    
}mmi_applist_page_indicator_struct;

#ifdef __MMI_APPLIST_APP_UNINSTALL_SUPPORT__
typedef struct
{
    S32 idx;
    mmi_applist_cell_type_enum cell_type;
} mmi_applist_user_tag;
#endif

typedef struct
{   
    MMI_ID parent_gid;
    void *app_mem_pool;
    KAL_ADM_ID adm_pool_id;
    #if defined(__MMI_PHNSET_APPICON_SUPPORT__) || defined(__MMI_DOWNLOADABLE_APPICON_SUPPORT__)
    MMI_BOOL is_cached;
    MMI_BOOL theme_changed;
    #endif

    #ifdef __MMI_APPLIST_SMART_ASM__
    MMI_BOOL can_cache_cell;
    #endif
    
    /* base layer */
    PU8 base_layer_buf_ptr;
    
    /* NVRAM */
    mmi_applist_data_struct data;

    /* app download icon */
    gdi_handle download_icon_handle;

    #ifdef __MMI_APPLIST_APP_UNINSTALL_SUPPORT__
    gdi_handle uninstall_icon_handle;
    U32 installed_id[MMI_APPLIST_PANEL_APP_NUM];
    mmi_applist_user_tag user_tag;
    #endif

    /* preinstall app id */
    U32 preinstall_id[MMI_APPLIST_PANEL_APP_NUM];
    
    MMI_BOOL mainmenu_need_sync;

    #ifdef __MMI_APPLIST_CACHE_APP_NAME__
    mmi_app_package_name_struct app_name[MMI_APPLIST_ENTRY_NUM];
    #endif
    
    mmi_applist_state_enum state;
    
    #ifdef __MMI_FONT_EFFECTS__
    stFontAttributeNode *font_attr;
    #endif

    //TODO: maybe reuse nvram data space
    mmi_applist_cell_struct *bar_cell[MMI_APPLIST_BAR_APP_NUM];
    mmi_applist_cell_struct *panel_cell[MMI_APPLIST_PANEL_APP_NUM];

    /* indicator */
    PU8 indicator_ptr;  //first is highlight and second is normal
    mmi_applist_page_indicator_struct indicator[MMI_APPLIST_MAX_PAGE_NUM];

    #ifdef __MMI_APPLIST_EDIT_WITH_BG__
    gdi_handle icon_bg_handle;
    #else
    mmi_applist_shake_info_struct shake_info;
    #endif

    mmi_applist_slide_region_info_struct slide_region;
    mmi_applist_slide_type_enum slide_type;
    mmi_applist_cell_struct *cell_pool;
    
    mmi_applist_anima_node_struct *anima_node_pool;
    mmi_applist_anima_node_struct *used_anima_tail;
    S32 empty_anima_index;

    mmi_applist_cache_struct *cache_pool;
    MMI_BOOL cache_used[MMI_APPLIST_APP_CACHE_NUM];
    S32 empty_cache_index;
    
    /* wallaper layer */
    gdi_handle wallpaper_layer_handle;
    #if !defined(__GDI_MEMORY_PROFILE_2__)
    PU8 wallpaper_layer_buf_ptr;
    #endif
    U32 blt_layer_flag;
    U32 play_layer_flag;
    
    /* status_bar_layer_handle */
    gdi_handle status_bar_layer_handle;
    PU8 status_bar_buf_ptr;

    /* panel layer handle */
    gdi_handle panel_layer_handle;
    PU8 panel_layer_buf_ptr;

    #ifdef __MMI_APPLIST_ONLY_ICON_SUPPORT__    
    /* title layer */
    gdi_handle title_layer_handle;
    PU8 title_layer_buf_ptr;
    #endif
    
    /* Wallpaper config */
    mmi_applist_vlw_config wp_config;
    mmi_applist_vlw_client wp_client;
    mmi_applist_wallpaper_state_enum wp_state;    
    mmi_applist_wp_stop_type_enum wp_stop_type;
    
    mmi_applist_mode_enum mode;
    S32 edit_page_num;
    mmi_applist_focus_cell_struct focus_cell;

    mmi_applist_cache_cell_struct cache_cell;

    mmi_applist_slide_state_enum slide_state;
    mmi_applist_hit_area_struct hit_area;
    
    #if defined(__MMI_TOUCH_SCREEN__)
    mmi_pen_point_struct pen_down_pos;
    mmi_pen_point_struct pen_last_pos;
    U32 pen_down_tick;
    S32 pen_down_page_idx;
    #endif   
    
    mmi_applist_dir_enum long_press_dir;
    #ifdef __MMI_APPLIST_KEY_SUPPORT__
    mmi_applist_hilight_frame_info_struct hilight_frame;
    U32 key_down_tick;
    #ifdef __MMI_APPLIST_KEY_LOOP__
    MMI_BOOL is_loop;  //loop from 0 to max or reverse
    #endif
    #endif /* __MMI_APPLIST_KEY_SUPPORT__ */
}mmi_applist_context_struct;

extern const mmi_app_package_name_struct g_mmi_applist_default_order[];
extern const S32 mmi_applist_default_order_count;
extern mmi_applist_context_struct *applist_p;

extern void mmi_applist_organize_cell(mmi_applist_hit_area_struct *hit_area);
extern void mmi_applist_load_data(void);
extern void mmi_applist_init_cell_info(void);
extern S32 mmi_applist_get_current_page_num(void);

extern S32 mmi_applist_get_bar_start_x(void);

extern S32 mmi_applist_get_last_panel_index(void);
extern void mmi_applist_get_cell_position(
                mmi_applist_cell_type_enum cell_type,
                S32 cell_idx,
                mmi_applist_position *pos);
extern S32 mmi_applist_get_current_page_idx(void);
extern S32 mmi_applist_get_cell_idx(S32 page_idx, S32 step_x, S32 step_y);
extern void mmi_applist_auto_slide(void);
extern void mmi_applist_cancel_auto_slide(void);
extern void mmi_applist_remove_cell(mmi_applist_cell_type_enum cell_type, S32 remove_idx);
extern S32 mmi_applist_add_panel_cell(S32 add_idx);
extern void mmi_applist_put_cache_cell(void);
extern void mmi_applist_reset_focus_cell(void);
extern void mmi_applist_set_indicator_info(S32 page_idx);
extern S32 mmi_applist_compact_page(void);
extern void mmi_applist_slide_to_page(S32 page_idx);
extern void mmi_applist_validate_slide_x(void);
extern void mmi_applist_save_data(void);
extern MMI_BOOL mmi_applist_if_hit_area_has_cell(mmi_applist_hit_area_struct *hit_area);
extern void mmi_applist_get_page_cell_idx(S32 page_idx, S32 *idx_from, S32 *idx_to);
extern void mmi_applist_cache_bar_cell(void);
extern void mmi_applist_cache_page(MMI_BOOL cache_page[], S32 *cell_start, S32 *cell_end);
extern U32 mmi_applist_get_cur_time(void);
extern void mmi_applist_blt_previous(void);

#ifdef __MMI_APPLIST_CACHE_PATH_APP_ICON__
extern void mmi_applist_delete_app_icon_cache_adm(void);
#endif
#if defined(__MMI_APPLIST_KEY_SUPPORT__) && !defined(__MMI_APPLIST_ONLY_ICON_SUPPORT__)
extern void mmi_applist_scroll_cell_string(void);
#endif

extern U32 mmi_applist_get_cell_id(mmi_applist_cell_type_enum type, S32 index);
extern mmi_applist_cell_struct *mmi_applist_get_cell_ptr(mmi_applist_cell_type_enum type, S32 index);
extern void mmi_applist_matrix_multiply(float *a, float *b, float *out);
extern void mmi_applist_get_panel_cell_location(
                S32 cell_idx, S32 *page_idx, S32 *step_x, S32 *step_y);
extern void mmi_applist_get_matrix(
                mmi_applist_matrix_type_enum type, 
                float value1,
                float value2,
                gdi_lt_matrix_struct *out);
extern S32 mmi_applist_draw_slide_area_icon(void);
extern float mmi_applist_sin(float rad);
extern float mmi_applist_cos(float rad);
extern void mmi_applist_wallpaper_blt(void);
extern void mmi_applist_open_wallpaper(void);
extern void mmi_applist_close_wallpaper(void);
extern void mmi_applist_start_wallpaper(void);
extern void mmi_applist_stop_wallpaper(mmi_applist_wp_stop_type_enum type);
extern void mmi_applist_delay_start_wallpaper(mmi_applist_wp_stop_type_enum type, S32 ms);

extern void mmi_applist_quiet_cache(void);

extern MMI_BOOL mmi_applist_is_preinstall(U32 app_id);
#ifdef __MMI_APPLIST_APP_UNINSTALL_SUPPORT__
extern MMI_BOOL mmi_applist_is_installed_app(U32 app_id);
extern void mmi_applist_get_installed_app_id(void);
#endif

#ifdef __MMI_TOUCH_SCREEN__
extern void mmi_applist_get_hit_area(S32 pos_x, S32 pos_y, mmi_applist_hit_area_struct *hit_area);
extern S32 mmi_applist_get_indicator_hit_index(S32 pos_x, S32 pos_y);
extern void mmi_applist_reposition_cell(void);
extern void mmi_applist_update_focus_cell_pos(void);
extern void mmi_applist_get_reposition_hit_area(S32 pos_x, S32 pos_y, mmi_applist_hit_area_struct *hit_area);
extern void mmi_applist_set_focus_cell_info(void);
extern void mmi_applist_change_slide_x(mmi_pen_point_struct pos);
#endif
#ifdef __MMI_APPLIST_KEY_SUPPORT__ 
extern S32 mmi_applist_get_final_page_idx(void);
extern void mmi_applist_init_hilight_index_in_page(void);
extern void mmi_applist_arrow_key_press(mmi_applist_dir_enum dir);
extern void mmi_applist_init_hilight_frame(S32 page_idx);
extern void mmi_applist_arrow_key_press_cyclic(void);

#endif /* __MMI_APPLIST_KEY_SUPPORT__ */

#if defined(__MMI_PHNSET_APPICON_SUPPORT__) || defined(__MMI_DOWNLOADABLE_APPICON_SUPPORT__)
extern MMI_BOOL mmi_applist_cache_theme_icon(void);
#endif

#endif /* __MMI_LAUNCHER_APP_LIST__ */ 
#endif /* _MMI_APPLIST_H_ */